Editorial Staff - - C Programming Tutorial
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.
1 2 3 4 5 6 7 8 9 10 11 12 | #include <stdio.h> int main() { int year, yr; printf("Enter the year "); scanf("%d", &year); yr = year % 100; printf("Last two digits of year is: %02d", yr); return 0; } |
Enter the year 2018
Last two digits of year is: 18
Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari View all posts by Editorial Staff