1 #include<stdio.h>
2 struct distance
3 {
4 int inch;
5 int feet;
6 float meter;
7 float cm;
8 };
9 void input(struct distance *,struct distance *);
10 int addist(struct distance *,struct distance *,struct distance *);
11 void display(struct distance *);
12 void convert(struct distance *);
13 int main()
14 {
15 struct distance d1,d2,d;
16 input(&d1,&d2);
17 addist(&d1,&d2,&d);
18 display(&d);
19 convert(&d);
20 return 0;
21 }
22 void input(struct distance *d1,struct distance *d2)
23 {
24 printf(“enter the distance in feet and inches\n”);
25 printf(“enter the 1st distance\n”);
26 scanf(“%d %d”,&d1->inch,&d1->feet);
27 printf(“enter the 2nd distance\n”);
28 scanf(“%d %d”,&d2->inch,&d2->feet);
29 }
30 int addist(struct distance *d1,struct distance *d2,struct distance *d)
31 {
32 (d->feet)=(d1->feet)+(d2->feet);
33 (d->inch)=(d1->inch)+(d2->inch);
34 if((d->inch)>12)
35 {
36 (d->inch)=(d->inch)-12;
37 (d->feet)=(d->feet)+1;
38 }
39 }
40 void display(struct distance *d)
41 {
42 printf(“sum of two distances in feet and inches\n”);
43 printf(“sum = %d feet %d inches\n”,d->feet,d->inch);
44 }
45 void convert(struct distance *d)
46 {
47 d->meter=(d->feet)/3.28;
48 d->cm=(d->inch)/0.393;
49 printf(“sum in meter and cm\n”);
50 printf(“sum = %f m and %f cm\n”,d->meter,d->cm);
51 }
1,1 Top