Hi. I've spent the last few days learning c programming and today I realised that I actually learned quite a bit. Bellow is the code for a program I made without refering to any form of refrence. I just did it from the top of my head.
It's not much but it's something.
#include <stdio.h>
main()
{
int birth_year, required_year, result;
printf("What year were you born?: ");
scanf("%d", &birth_year);
printf("What year do you want to know your age for?: ");
scanf("%d", &required_year);
result = required_year - birth_year;
if (result < 0)
printf("You were not born in %d", required_year);
else if (result == 0)
printf("You were born in %d", required_year);
else
printf("In the year %d you will be %d years old", required_year, result);
printf("\n");
return 0;
}
It's not much but it's something.