Search This Blog

Translate

C program to accept seconds and convert it into hour,minute and seconds

C program  to read seconds and convert it into hour,minute and seconds,
C program to accept  seconds and convert it into hour,minute and seconds

#include
#include
void main()
{
long sec;
int h=0,m=0,s=0;
clrscr();
printf("Enter the time in seconds=");
scanf("%ld",&sec);
while(sec>0)
{
if(sec>=(60*60))
{
h++;
sec=sec-(60*60);
continue;
}
if(sec>=60)
{
m++;
sec=sec-60;
continue;
}
if(sec<60 font="">
{
s=sec;
break;
}

}
printf("\n\n After converting the seconds in hour,minute and second format is=");
printf("\n\n\nHour=%d \n\n Minute=%d \n\n Second=%d",h,m,s);
getch();
}


C program  to read seconds and convert it into hour,minute and seconds,
C program to accept  seconds and convert it into hour,minute and seconds

C Program example List

Google+ Badge