Skip to content

Instantly share code, notes, and snippets.

@Cousin
Created May 21, 2017 17:28
Show Gist options
  • Save Cousin/f9b56321484b2f73768d04e41e6a5b79 to your computer and use it in GitHub Desktop.
Save Cousin/f9b56321484b2f73768d04e41e6a5b79 to your computer and use it in GitHub Desktop.
helo am c devloper
#include <stdio.h>
#include <ctype.h>
int main() {
printf("Please enter your name\n");
char yourName[20];
scanf("%s", yourName);
char firstChar = yourName[0];
if (firstChar >= 'a' && firstChar <= 'z') {
yourName[0] = (char) toupper(firstChar);
}
printf("What year were you born?\n");
int year = 0000;
scanf("%d", &year);
if (year < 1900 || year > 2017) {
printf("Don't lie to me, %s", yourName);
return 0;
}
int calculatedAge = 2017 - year;
printf("Well, %s, according my calculations you are %d-%d years old.", yourName, calculatedAge - 1, calculatedAge);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment