Write a C program named speed.c. This program should read two values, a number o
ID: 669599 • Letter: W
Question
Write a C program named speed.c. This program should read two values, a number of furlongs and a number of fortnights. Your program should then compute a speed in both furlongs per fortnight and miles per hour. As a quick reminder: • A furlong is 660 feet (220 yards), or one-eighth of a mile. • There are 5280 feet (1760 yards) in one mile. • A fortnight is two weeks, and there are seven days in one week. The basic structure of the program should look like this: #include ... int main( ) { ... return 0; } Where you see the ..., you should add code to: • Prompt the user to enter an integer value corresponding to a number of furlongs. Read this value. • Prompt the user to enter an integer value corresponding to a number of fortnights. Read this value. • Calculate and print the speed in furlongs per fortnight. • Calculate and print the speed in miles per hour. Your program should run like this if you entered 100 and 2 as your input: Enter the number of furlongs traveled : 100 Enter the number of fortnights it took : 2 Your speed is 50 furlongs-per-fortnight This is 0.018601 miles-per-hour
Explanation / Answer
#include <stdio.h>
int main()
{
double fur,fort;
printf("Enter number of furlongs: ");
scanf("%lf",&fur);
printf("Enter number of fortnights: ");
scanf("%lf",&fort);
double speedFurperFort=fur/fort;
double miles=fur/8;
double hours=336;
double milesperHour=miles/hours;
printf("Speed: %lf furlongs/fortnights ",speedFurperFort);
printf("Speed: %lf miles/hour ",milesperHour);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.