读取名字和身高并显示信息

#include stdio.hint main(void){const float INCHES_PER_FEET = 12;float height;char name[40];printf(What is your name?: );

编程学习网为您整理以下代码实例,主要实现:读取名字和身高并显示信息,希望可以帮到各位朋友。

#include <stdio.h>

int main(voID)
{
  const float INCHES_PER_FEET = 12;
  float height;
  char name[40];

  printf("What is your name?: ");
  scanf("%s", name);
  printf("What is your height in inches?: ");
  scanf("%f", &height);
  printf("%s, you are %.3f feet tall.\n", name, height / INCHES_PER_FEET);

  return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐