Computer Science, asked by kalariyadhruvin60, 10 months ago

Write a program to accept number of seconds and display its corresponding hours, minutes and seconds.

Answers

Answered by prisha2204
0

Answer:

Is it BlueJ programming?

Answered by lovingheart
0

A program to accept number of seconds and display its corresponding hours, minutes and seconds:

#include<conio.h>

void main()

{

int sec,hr,min;

clrscr();

printf("enter sec:-");

scanf("%d",&sec);

hr=sec/3600;

sec=sec%3600;

min=sec/60;

sec=sec%60;

printf("%d hr %d min %d sec ",hr,min,sec);

getch();

}

This is a simple program where the seconds are obtained. The seconds’ value is divided by 3600 to get the value of hour and then its remainder is obtained to store in the variable of seconds and then it is divided by 60 to get the minutes.

Similar questions