Here is source code of the C Program to extract last two digits of a given year. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Extract Last two Digits of a given Year
int year, yr;
printf("Enter the year ");
yr = year % 100;
printf("Last two digits of year is: %02d", yr);
Output: $ cc pgm34.c $ a.out Enter the year 2012 Last two digits of year is: 12
Sanfoundry Global Education & Learning Series – 1000 C Programs.