Brijmohan lal Sahu - Facebook
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, December 10, 2014

Program to convert hours into days and print numbers of days and remaining hours in C.

Hours to day converter in C


Code Box
------------------------------------------------

/*Program to enter hours and print numbers of days and remaining hours */

#include<stdio.h>
#include<conio.h>
void main()
{

int hours,rhours;
/*hours for hours enter by User and rhours for remaining hours */

int days;
/*For numbers of Day */

clrscr();

printf("\n\tHours to Day Converter");
printf("\n\tEnter Hours :");
scanf("%d",&hours);


rhours=hours%24;

/*Modulus operator provide us the remainder after Division which is remaining hours */


days=hours/24;
/*Division operator to calculate Days as we know 24 hours means 1 Day */


printf("\n\tNumber of Days : %d",days);
printf("\n\tRemaining Hours: %d",rhours);


getch();
}