Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having the hardest time understaing loops in C I need to make sure I have t

ID: 3624024 • Letter: I

Question

I am having the hardest time understaing loops in C
I need to make sure I have the following requirements:
* This program should have 1 variable of type int, and 5 or 6 of type float.
* This program should have three printf/scanf’s to enter the three conversion amounts
* This program requires a for loop to process the three amounts.
* The loop itself requires 5 printf statements: 1 to prompt the user for the "US dollars #1 to be converted"; and
4 to output the results as above.
* The loop also requires 1 scanf statement to "read in" the number of dollars which is input by the user;
* There are 4 calculations within the loop - one for each conversion, and an accumulater to total the inputs.
* The loop index is used to display the current dollar conversion calculation(Enter US dollars #1 to be converted: etc).


The output should read:

The program will convert three US dollar amounts to
Danish Krones, Euros and Hong Kong Dollars.

First, please enter the exchange rates:
Danish Krones: 5.74087
Euros: .770602
Hong Kong Dollars: 7.77639


Enter US dollars #1 to be converted: 12.95

12.95 US dollars is equivalent to:

74.34 Danish Krones
9.98 Euros
100.68 Hong Kong Dollars

Enter US dollars #2 to be converted: 32.00

32.00 US dollars is equivalent to:

183.71 Danish Krones
24.66 Euros
248.84 Hong Kong Dollars

Enter US dollars #3 to be converted: 10

10.00 US dollars is equivalent to:

57.41 Danish Krones
7.71 Euros
77.76 Hong Kong Dollars

You have converted a total of $54.95

Explanation / Answer

please rate - thanks

#include <stdio.h>
#include <conio.h>
int main()
{int i;
float krones,euros,hongkong,US,amt,total=0;
printf("Enter the Danish Krones exchange rate: ");
scanf("%f",&krones);
printf("Enter the Euros exchange rate: ");
scanf("%f",&euros);
printf("Enter the Hong Kong Dollars exchange rate: ");
scanf("%f",&hongkong);
for(i=1;i<=3;i++)
    {printf(" Enter US dollars #%d to be converted: ",i);
    scanf("%f",&US);
    total+=US;
    printf(" %.2f US dollars is equivalent to: ",US);
    amt=krones*US;
    printf("%.2f Danish Krones ",amt);
    amt=euros*US;
    printf("%.2f Euros ",amt);
    amt=hongkong*US;
    printf("%.2f Hong Kong Dollars ",amt);
   }
printf("You have converted a total of $%.2f ",total);
getch();
return 0;
}