Q-1: Write a program to accept two distances(first distance in feet and inches & second distance in feet and inches……….4 values are to be accepted by user).Display the sum of these two distances with feet & inches. PYTHON
Answers
Answered by
0
Answer:
include <stdio.h> struct Distance { int feet; float inch; } d1, d2, result; int main() { printf("Enter 1st distance\n"); printf("Enter feet: "); scanf("%d", &d1.feet); printf("Enter inch: "); scanf("%f", &d1.inch); printf("\nEnter 2nd distance\n"); printf("Enter feet: "); scanf("%d", &d2.feet); printf("Enter inch: "); scanf("%f", &d2.inch); result.feet = d1.feet + d2.feet; result.inch = d1.inch + d2.inch; // while inch is greater than 12, changing it to feet. while (result.inch > 12.0) { result.inch = result.inch - 12.0; ++result.feet; } printf("\nSum of distances = %d\'-%.1f\"", result.feet, result.inch); return 0; }
Explanation:
please mark as brainlist
Answered by
0
Explanation:
hope it is helpful to you
Attachments:
Similar questions
Science,
4 months ago
History,
4 months ago
English,
8 months ago
Biology,
8 months ago
Environmental Sciences,
11 months ago