Write a program to input seconds and dislay time broken as hours minutes and seconds?
Answers
Answered by
2
This program is written in C language
It first calc secs into mins.
And then it checks if the user has entered secs which constitute to more than 60 mins or less than 60 mins.
If the total minutes calculated are above 60 then the hours conversion logic code is executed.
#include<stdio.h>
int main(){
int n,hr,min,sec;
printf("Enter seconds:");
scanf("%d",&n);
if(n>3600){
min = n/60;
sec = n%60;
hr = min/60;
min = min%60;
printf("Converted format %d hour %d mins %d secs",hr,min,sec);
}
else{
min = n/60;
sec = n%60;
printf("Converted format %d mins %d secs",min,sec);
}
}
ashamishra170pci228:
sry in java i want
Similar questions