-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path6.c
More file actions
35 lines (27 loc) · 637 Bytes
/
Copy path6.c
File metadata and controls
35 lines (27 loc) · 637 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
struct date
{
int day;
int month;
int year;
};
struct date convertToDate(long int dateValue)
{
struct date d;
d.day = (dateValue % 100);
dateValue /= 100;
d.month = (dateValue % 100);
dateValue /= 100;
d.year = (dateValue);
return d;
}
int main()
{
long int inputtedDate;
struct date convertedDate;
printf("Enter the date as a long integer: ");
scanf("%ld", &inputtedDate);
convertedDate = convertToDate(inputtedDate);
printf("The converted date is: %02d-%02d-%04d\n", convertedDate.day, convertedDate.month, convertedDate.year);
return 0;
}