code :
#include<stdio.h>
#include<stdlib.h>
struct distance
{
int feet,meter;
float inch,cm;
};
struct distance display(struct distance d1,struct distance d2,struct distance d3,struct distance d4);
struct distance convert(struct distance d3);
struct distance addlist(struct distance d1 ,struct distance d2);
struct distance input ();
int main()
{
system(“clear”);
struct distance d1,d2,d3,d4;
d1=input();
d2=input();
d3=addlist(d1,d2);
d4=convert(d3);
display(d1,d2,d3,d4);
return 0;
}
struct distance input ()
{
struct distance d;
printf(“Enter distance in feet\n”);
scanf(“%d”,&d.feet);
printf(“Enter distance in Inches\n”);
scanf(“%f”,&d.inch);
return d;
}
struct distance addlist(struct distance d1 ,struct distance d2)
{
struct distance d;
d.feet=d1.feet+d2.feet;
d.inch=d1.inch+d2.inch;
if(d.inch >11)
{
d.feet++;
d.inch=d.inch-12;
}
return d;
}
struct distance convert(struct distance d3)
{
struct distance d;
d.meter=d3.feet*0.30;
d.cm=d3.inch*2.54;
return d;
}
struct distance display(struct distance d1,struct distance d2,struct distance d3,struct distance d4)
{
printf(“feet: %d + %d =%d \n inch: %f + %f =%f\n”,d1.feet,d2.feet,d3.feet,d1.inch,d2.inch,d3.inch);
printf(“feet:%d inch:%f=%dm%fcm\n”,d3.feet,d3.inch,d4.meter,d4.cm);
}