Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int d, m, y;
clrscr();
printf("Enter any date in format dd-mm-yyyy : ");
scanf("%d-%d-%d", &d, &m, &y);
printf("Given date is : %.2d-%.2d-%.2d",d,m,y);
getch();
}
Output:
Enter any date in format dd-mm-yyyy : 29-08-2021
Given date is : 29-08-2021
Next Topic : Operators in C
Previous Topic : To enter any ASCII Value and display it's Character
No comments:
Post a Comment