Computer Science, asked by akashmalviya90, 1 year ago

Write a program in C to accept time in second and display it in hr and min and sec also. ​

Answers

Answered by charlie1505
1

Explanation:

// into days, hours,minutes,seconds

#include <bits/stdc++.h>

#include<stdio.h>

// function convert second into day

// hours, minutes and seconds

void ConvertSectoDay(int n)

{

int day = n / (24 * 3600);

n = n % (24 * 3600);

int hour = n / 3600;

n %= 3600;

int minutes = n / 60 ;

n %= 60;

int seconds = n;

printf("\n ℅d &day, ℅d &hour, ℅d &minutes , ℅d &seconds", day, hour, minutes, seconds) ;

}

// Driver code

int main()

{

// Given n is in seconds

int n = 129600;

ConvertSectoDay(n);

return 0;

}

Similar questions