33 lines
656 B
C
33 lines
656 B
C
//use onlinegdb.com
|
|
// Example 3
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
/*
|
|
// declare an int variable: age
|
|
int age;
|
|
//declare a string: userName
|
|
char userName[100];
|
|
|
|
//ask for the input,
|
|
//Good practice: prompt some hint
|
|
printf("Enter Name and Age (serperated by space): ");
|
|
scanf("%s %d", userName, &age);
|
|
|
|
//ask for name
|
|
|
|
//ask for age
|
|
//display the infomation
|
|
|
|
printf("Hello %s\nYou are %d years old.\n", userName, age);
|
|
//ask for more than one input
|
|
*/
|
|
|
|
char letter;
|
|
printf("Please give me a letter: ");
|
|
scanf("%c", &letter);
|
|
printf("your letter is: %c\n", letter);
|
|
|
|
return 0;
|
|
}
|