Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct british
- {
- float ft;
- float in;
- }b1,b2;
- struct metric
- {
- float m;
- float cm;
- }m1,m2;
- int main()
- {
- float a,b;
- printf("Enter the values in m and cm\n");
- scanf("%f%f",&a,&b);
- m1.m=a;
- m1.cm=b;
- printf("Enter the values in ft and in\n");
- scanf("%f%f",&a,&b);
- b1.ft = a;
- b1.in = b;
- b2.ft = m1.m *3.28;
- b2.in = m1.cm *0.39;
- m2.m = b1.ft *(1/3.28);
- m2.cm = b2.in *(1/0.39);
- printf("The addition is %.2f m and %.2f cm\n", m1.m+m2.m,m1.cm+m2.cm);
- printf("The addition is %.2f ft and %.2f in", b1.ft+b2.ft,b1.in+b2.in);
- return 0;
- }
- //Output
- //Enter the values in m and cm
- //5.67
- //7.11
- //Enter the values in ft and in
- //6.7
- //2.44
- //The addition is 7.71 m and 14.22 cm
- //The addition is 25.30 ft and 5.21 in
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement