Created
December 29, 2016 22:45
-
-
Save s3f/b38b42294ec9c45fdb229410eab17b2b to your computer and use it in GitHub Desktop.
Chapter 8 - Getting User Input created by s3f - https://repl.it/EcYQ/3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This sample program asks a user for some basic data and prints it on the screen in order to show what was entered. | |
#include <stdio.h> | |
main() | |
{ | |
char firstInitial; | |
char lastInitial; | |
int age; | |
int favorite_number; | |
printf("What letter does your first name begin with?\n"); | |
scanf(" %c", &firstInitial); | |
printf("What letter does your last name begin with?\n"); | |
scanf(" %c", &lastInitial); | |
printf("How old are you?\n"); | |
scanf(" %d", &age); | |
printf("What is your favorite number(Integer only)?\n"); | |
scanf(" %d", &favorite_number); | |
printf("\nYour initials are %c.%c. and you are %d years old", firstInitial, lastInitial, age); | |
printf("\nYour favorite number is %d.\n\n", favorite_number); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment