11-C Practical-03 Algorithm for read time in hours, time in minutes, time in seconds and print time in seconds.
Input
1)h 2)m 3)s
output
1)Sec
Method
1.start
2.Read h,m & s //cin>>h>>m>>s;
3.write h,m & s // cout<<"h="<<h;
4. H=h*60*60;
M=m*60;
S=s;
Sec=H+M+S;
5.Write Sec;
Program
#include<iostream.h>
void main()
{
int h,m,s,H,M,S,Sec;
cout<<"Enter the h,m and s \n";
cin>>h>>m>>s;
cout<<"h="<<h;
cout<<"m="<<m;
cout<<"s="<<s;
H=h*60*60;
M=m*60;
S=s;
Sec=H+M+S;
cout<<"Seconds="<<Sec;
}
No comments:
Post a Comment