C examples for Language Basics:scanf
Read your height inches and name, output height in feet
#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; }