nested structure in c and using that finding the distance between two place
// using structure add two distance
#include<stdio.h>
struct distance
{
int feet;
float inch;
};
struct moredistance
{
int meter;
float centi;
}
distance1, distance2,sum;
int main()
{
printf("enter the distance1 in feet:\n");
scanf("%d",&distance1.meter);
printf("enter the distance 2 in inch\n");
scanf("%f",&distance2.centi);
sum.meter=distance1.meter+distance2.centi;
printf("sum of distance1 and distance 2 is %d",sum.meter);
}
Comments
Post a Comment