If statement
#include<iostream.h>
#include<conio.h>
void main()
{
int h,m,s,r,add,div;
clrscr();
cout<<"enter your time";
cin>>h>>m>>s;
cout<<"enter increse second";
cin>>add;
s=s+add;
if(s>=60)
{
div=s/60;
s=s%60;
m=m+div;
}
if(m>60)
{
div=m/60;
m=m%60;
h=h+div;
}
cout<<"now your time is"<<h<<":"<<m<<":"<<s<<endl;
getch();
}
#include<conio.h>
void main()
{
int h,m,s,r,add,div;
clrscr();
cout<<"enter your time";
cin>>h>>m>>s;
cout<<"enter increse second";
cin>>add;
s=s+add;
if(s>=60)
{
div=s/60;
s=s%60;
m=m+div;
}
if(m>60)
{
div=m/60;
m=m%60;
h=h+div;
}
cout<<"now your time is"<<h<<":"<<m<<":"<<s<<endl;
getch();
}
Post a Comment