In this program, we are going to share a C program to extract last two digits of a given year. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to extract last two digits of a given year with the output.
We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.
int year, yr;
printf("Enter the year ");
yr = year % 100;
printf("Last two digits of year is: %02d", yr);
Enter the year 2018
Last two digits of year is: 18