Friday 12 October 2012

Function026

Write a function that takes time in seconds as input and print it in terms of hour, minute and seconds.

#include <stdio.h>
#include <conio.h>
void hrminsec ( int    sec )
{                                
        int      hr, min, t;
                     
        min = sec / 60;
        sec = sec % 60;
        hr = min / 60;
        min = min % 60;
        printf("\n\n\t\t Hr:%d Min:%d Sec:%d",hr,min,sec);
}                            
                       
void main ( )
{                        
        int         sec;
        clrscr ( );
                   
        printf("\n\n\n\n\t Enter the time in seconds..:"); scanf("%d",&sec);
        hrminsec ( sec );
        getch ( );
}
Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...