To enter any date in date format and to display the given date.

 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

No comments:

Post a Comment