A program that read any date in the entire following format i) DD/MM/YYYY ii) DD-MM-YYYY iii) DD MM YYYY iv) DD,MM,YYYY & displays day, month & year separately in C.

#include<stdio.h>
#include<conio.h>

void main()
{
    int d,m,y;
    clrscr();
    printf("Enter any date in formate (DD/MM/YYYY) : ");
    scanf("%d/%d/%d",&d,&m,&y);
   
    printf("\nDay = %d\nMonth = %d\nYear = %d",d,m,y);
   
    printf("Enter any date in formate (DD-MM-YYYY) : ");
    scanf("%d-%d-%d",&d,&m,&y);
   
    printf("\nDay = %d\nMonth = %d\nYear = %d",d,m,y);

    printf("Enter any date in formate (DD MM YYYY) : ");
    scanf("%d %d %d",&d,&m,&y);
   
    printf("\nDay = %d\nMonth = %d\nYear = %d",d,m,y);

    printf("Enter any date in formate (DD,MM,YYYY) : ");
    scanf("%d,%d,%d",&d,&m,&y);
   
    printf("\nDay = %d\nMonth = %d\nYear = %d",d,m,y);
    getch();
}



///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........