Write a fortan program that takes a certain amount of money

Write a fortan program that takes a certain amount of money as input and out puts how many of each type of American coins it would take to make up that amount of money. Please include if statements when making the program. (Example: $1.68 is the input, 6 quarters, 1 dime, 1 nickel, and 3 pennies is the output.) thanks in advance.
Write a fortan program that takes a certain amount of money as input and out puts how many of each type of American coins it would take to make up that amount of money. Please include if statements when making the program. (Example: $1.68 is the input, 6 quarters, 1 dime, 1 nickel, and 3 pennies is the output.) thanks in advance.

Solution

Fortan Program

It is impossible to have 19 coins of the same type that equal one dollar.

3 pennies = $1.68+$1.68+$1.68=$3.48

1 nickels = $1.68

,6 quarters=$1.68+$1.68+$1.68+$1.68+$1.68+$1.68=$6.88

1 dem= $1.68

1 dimes = $1.68 (too big so quarters and half dollars are also eliminated)

DollAR=$1.68 % Input of the program

3 pennies = $1.68+$1.68+$1.68=$3.48

1 nickels = $1.68

,6 quarters=$1.68+$1.68+$1.68+$1.68+$1.68+$1.68=$6.88

1 dem= $1.68

Money=6 quarters+1 dime+1 nickel+3 pennies

print* * \"Money\"

DollAR=$1.68 dividing the coins

print* * \"$1=idem\"

end program

A Fortran program reads from standard input or from a file using the read statement, and it can write to standard output using the print statement. With the write statement one can write to standard output or to a file. Before writing to a file, the file must be opened and assigned a unit number with which the programmer may reference the file. If one wishes to use the write statement to write a statement to the default output, the syntax is write(*,*). It is used as follows:

Example

 Write a fortan program that takes a certain amount of money as input and out puts how many of each type of American coins it would take to make up that amount

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site