timestamp maker
#include <stdio.h>
typedef struct timestamp{
int day;
int month;
int year;
int hours;
int min;
int sec;
}tmp;
int main() {
// Write C code here
int n;
printf("enter no of timepstamp you want : ");
scanf("%d",&n);
tmp t[24];
for (int i = 0 ; i<n;i++){
printf("enter the day for %d timestamp: " , i+1 );
scanf("%d",&t[i].day);
printf("enter the month for %d timestamp: " , i+1);
scanf("%d",&t[i].month);
printf("enter the year for %d timestamp: " , i+1 );
scanf("%d",&t[i].year);
printf("enter the hours for %d timestamp: " , i+1 );
scanf("%d",&t[i].hours);
printf("enter the min for %d timestamp: " , i+1 );
scanf("%d",&t[i].min);
printf("enter the sec for %d timestamp: " , i+1 );
scanf("%d",&t[i].sec);
}
for (int i = 0 ; i<n;i++){
printf("the timestamp is for %d timestamp: %d-%d-%d %d:%d:%d\n", i+1 ,t[i].day,t[i].month,t[i].year
, t[i].hours , t[i].min,t[i].sec);//dd-mm-yyyy hh:mm:ss format
}
return 0;
}
Comments
Post a Comment