Hi, I just started teaching myself C programming.(today)
So I'm very new and never learned a language before.
I have several video tutorials that tought the basics.
But I'm having some trouble.
My goal-
Make a simple program that can tell:
1. How old someone half my age would be.
2. How many years its been since the age of 10.
3. What year was I born
I want to start off by asking the age of the user using the program
so this is how I started.
Please explain why it doesn't work lol thanks in advanced
Code:
#include <stdio.h>
int main()
{
int age; // How old the user is
int x; //How old someone half my age would be.
int y; //How many years its been since the age of 10
int z; // What year was I born in.
printf("How old are you? ");
scanf("%d", &age);
x = age / 2;
y = age - 10;
z = 2008 - age;
printf("You are %d years old. It's been %d since you were 10. And you were born in %d\n", age, y, z);
fflush(stdin); //flushing an input stream is ill advised, now. Only output streams
getchar();
return 0;
}