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

Saturday, November 29, 2014

Program to enter hours and print numbers of days and remaining hours 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();
}

No comments: