30. Y2K Problem Detector

Image result for c programming
Code:
  #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",&current);
  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;
}
  

No comments