jituTechnology

jituTechnology

write a program to illustrate modulus operator in which second is given as an input and the program converts it to hours, minutes and seconds

/*A program to illustratet the modulus operator in which second is given as an input and the program converts it to houurs,minutes and seconds.
programmed by:
Name: Jitendra Kumar Yadav
Roll: 16
Date: 11 jan 20119*/
#include <stdio.h>
#include <conio.h>
void main()
{
int hours,minutes,seconds,z;
printf(“Enter the time in seconds: “);
scanf(“%d”,&seconds);
hours=seconds/(60*60);
z=seconds%(60*60);//modulus operator to give remainder
minutes=z/60;//it will only give quotient which is minutes
seconds=z%60;//it will give remainder which is seconds
printf(“%d hours %d minutes %d seconds”,hours,minutes,seconds);
getch();
}

No comments yet.

Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800

Calendar

November 2025
S M T W T F S
 1
2345678
9101112131415
16171819202122
23242526272829
30