How old are you? (output)
23 ⏎ (input)
You are 23 years old. (output)
#include <stdio.h>
int main (void) {
int age;
printf("How old are you?\n");
scanf("%d", &age);
printf("You are %d years old.\n", age);
return 0;
}
Download source1.c
Please input your age and height (cm). (output)
23 ⏎ (input)
172.3 ⏎ (input)
Your age is 23 and your height is 172.3 cm. (output)
#include <stdio.h>
int main (void) {
int age;
double height;
printf("Please enter your age and height(cm).\n");
scanf("%d", &age);
scanf("%lf", &height);
printf("Your age is %d and your height is %.1lf cm.\n", age, height);
return 0;
}
Download source2.c