You are on page 1of 1

PROGRAM CODE: #include<iostream.h> #include<conio.

h> struct distance { int feet; int inches; }; void main() { clrscr(); distance length1,length2; void prnsum(distance &l1, distance &l2); cout<<Enter length 1:<<\n; cout<<Feet; cin>>length1.feet; cout<<\n<<Inches:; cin>>length1.inches; cout<<\n\n Enter length2:<<\n; cout<<Feet; cin>>length2.feet; cout<<\n<<Inches:; cin>>length2.inches; prnsum(length1,length2); } void prnsum(distance &l1,distance &l2) { distance l3; l3.feet=l1.feet+l2.feet+(l1.inches+l2.inches)/12; l3.inches=(l1.inches+l2.inches)%12; cout<<\n\n Total Feet:<<l3.feet<<\n; cout<<Total inches:<<l3.inches; } SAMPLE INPUT AND OUTPUT: Enter length1: Feet: 3 Inches: 11 Enter length2: Feet: 4 Inches: 5 Total Feet: 8 Total Inches: 4

You might also like