-->

program to convert total seconds into hour,minutes and seconds

// program to convert total seconds into hour,minutes and seconds
#include<stdio.h> #include<conio.h> void main() { clrscr(); int total_seconds,hr,minutes,seconds; printf("enter total seconds \n"); scanf("%d",&total_seconds); hr=total_seconds/3600; // to get hour after dividing total seconds by 3600 printf("hours =%d\n",hr); hr=total_seconds%3600; // after getting hours, we have to get total left second minutes=hr/60; // to get total minutes printf("total minutes=%d\n",minutes); seconds=hr%60; // it gives total left seconds as seconds after getting months printf("the seconds=%d\n",seconds); getch(); }

note:
Here I have used same variable again and again. But I you want then you can use different variable