Convert seconds to (hours, minutes, seconds)format

Go down

Convert seconds to (hours, minutes, seconds)format

Post  BaDz on Tue Aug 04, 2009 9:48 pm

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

BaDz
Admin

Posts : 7
Join date : 2009-06-15

View user profile

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum