Read your height inches and name, output height in feet - C Language Basics

C examples for Language Basics:scanf

Description

Read your height inches and name, output height in feet

Demo Code

#include <stdio.h>  
int main(void)  
{  /*  www . ja v  a2 s .  com*/
    float height;  
    char name[40];  
      
    printf("Enter your height in inches: ");  
    scanf("%f", &height);  
    printf("Enter your name: ");  
    scanf("%s", name);  
    printf("%s, you are %.3f feet tall\n", name, height / 12.0);  
      
    return 0;  
}

Result


Related Tutorials