Convert seconds to (hours, minutes, seconds)format
Page 1 of 1
Convert seconds to (hours, minutes, seconds)format
Write an interactive program that asks the user to input the time in seconds and convert to hour, minutes and seconds.....
Please Just don't copy and paste but study about it and understand the program. Thank You and God Bless
#include <stdio.h>
#include <conio.h>
void main()
{
int number, hours, seconds,temp ,minutes;
clrscr();
printf("Enter any number to convert:");
scanf("%d",&number);
temp=number;
hours=number/3600; printf("\n%d",hours);
number=temp%3600; printf("\n%d",number);
minutes=number/60; printf("\n%d",minutes);
number=temp%60; printf("\n%d",number);
seconds=number; printf("\n%d",seconds);
printf("\n%d hour(s) %d minute(s) %d second(s)", hours, minutes, seconds);
getch();
}
-BaDz- regards:)
visit our website www.psycho-spiritual-formation.tk
Please Just don't copy and paste but study about it and understand the program. Thank You and God Bless
#include <stdio.h>
#include <conio.h>
void main()
{
int number, hours, seconds,temp ,minutes;
clrscr();
printf("Enter any number to convert:");
scanf("%d",&number);
temp=number;
hours=number/3600; printf("\n%d",hours);
number=temp%3600; printf("\n%d",number);
minutes=number/60; printf("\n%d",minutes);
number=temp%60; printf("\n%d",number);
seconds=number; printf("\n%d",seconds);
printf("\n%d hour(s) %d minute(s) %d second(s)", hours, minutes, seconds);
getch();
}
-BaDz- regards:)
visit our website www.psycho-spiritual-formation.tk
BaDz- Admin
- Posts : 7
Join date : 2009-06-15
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|