Write a program that asks a user for their birth year encoded as two digits (like "62") and for the current year, also encoded as two digits (like "99"). The program is to correctly write out the users age in years code example
Example: Write a program that asks a user for their birth year encoded as two digits (like "62") and for the current year, also encoded as two digits (like "99"). The program is to correctly write out the users age in years
#include<stdio.h>
int main(){
signed int current, birth, a;
printf("Enter Year of Birth\n");
scanf("%d",&birth);
printf("Enter Current year\n");
scanf("%d",¤t);
if(current<birth)
{
birth=100-birth;
a=birth+current;
printf("Your age is %d",a);
}
else
{
printf("Your age is %d",current-birth);
}
return 0;
}