skip to main |
skip to sidebar
/*PROGRAM TO FIND THE SUM OF DISTANCE EXPRESSED IN
KILOMETRE,METRE AND CENTIMETRE*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int k1,k2,k,m1,m2,m,me,c1,c2,c,b,d,a,cm;
cout<<"enter the first length in km,m,cm\n";
cin>>k1>>m1>>c1;
cout<<"enter the second length in km,m,cm\n";
cin>>k2>>m2>>c2;
c=c1+c2;
a=c/100;
cm=c%100;
m=m1+m2+a;
d=m/1000;
me=m%1000;
k=k1+k2+d;
cout<<"sum is\n"<<k<<"km"<<"\t"<<me<<"metre"<<"\t"<<cm<<"cm";
getch();
}
OUTPUT:
enter the first length in km,m,cm
2 50 120
enter the second length in km,m,cm
1 50 100
sum is
3Km 102metre 20cm
0 comments:
Post a Comment