EmbLogic's Blog

add distance in feets and inches

1         #include<stdio.h>
2          int main()
3         {
4         float  feet, inch,feet1,feet2,inch1,inch2;
5         printf(“enter 1st distance in feet\n”);
6         scanf(“%f”, &feet1);
7         printf(“enter 1st distance in inches\n”);
8         scanf(“%f”, &inch1);
9         printf(“enter 2nd distance in feet\n”);
10         scanf(“%f”, &feet2);
11         printf(“enter 2nd distance in inches\n”);
12         scanf(“%f”, &inch2);
13         feet= feet1 + feet2;
14         inch=inch1 + inch2;
15         if (inch > 12)
16         {
17         inch=inch – 12;
18         feet++;
19         printf(“%4.2f\n”, feet);
20         printf(“%4.2f\n”, inch);
21         }
22         return 0;
23         }
~
~
~

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>