Sunday, July 4, 2010

PROGRAM TO FIND SUM OF TWO LENGTHS EXPRESSED IN FEET AND INCH

Buzz It
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int f1,f2,f,i1,i2,i,s,x,y;
cout<<"enter the first length in feet and inch\n";
cin>>f1>>i1;
cout<<"enter the second length in feet and inch\n";
cin>>f2>>i2;
f=f1+f2;
i=i1+i2;
x=i/12;
y=i%12;
s=f+x;
cout<<"sum of two length in feet and inch
is\n"<<s<<"feet"<<"\t"<<y<<"inch”; getch();
}

OUTPUT:
enter the first length in feet and inch
2 6
enter the second length in feet and inch
3 8
sum of two length in feet and inch is
6feet 2inch


0 comments:

Post a Comment