Question: *PLEASE RESPOND IN CORAL LANGUAGE* Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If
*PLEASE RESPOND IN CORAL LANGUAGE*

Write a program using integers userNum and x as input, and output userNum divided by x four times.
Ex: If the input is:
2000 2
the output is:
1000 500 250 125
Note: In Coral, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
MY code only got me one out of three answers right, but i need all three answers (second screenshot)
MY CODE:
integer userNum
integer x
userNum = Get next input
userNum = userNum / x
Put userNum to output
Put " " to output
userNum = userNum / x
Put userNum to output
Put " " to output
userNum = userNum/x
Put userNum to output
And like this for 1.27...
float milesPerGallon
float dollarsPerGallon
float dollarsPerMile
float result
milesPerGallon = Get next input
dollarsPerGallon = Get next input
dollarsPerMile = dollarsPerGallon / milesPerGallon
result = 10 * dollarsPerMile
Put result to output with 2 decimal places
Put " " to output
result = 50 * dollarsPerMile
Put result to output with 2 decimal places
Put " " to output
result = 400 * dollarsPerMile
Put result to output with 2 decimal places
Message
1.26 LAB: Variables/Assignments: Divide by x Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If the input is: 2000 2 the output is: 1000 500 250 125 Note: In Coral, integer division discards fractions. Ex: 6/4 is 1 (the 0.5 is discarded). 320640.1753052 qx ? LAB ACTIVITY 1.26.1: LAB: Variables/Assignments: Divide byx 4/10 Load default template... Variables 1 integer user Num 2 3 teger x Not shown when editing 5 6 7 user Num = Get next input Input 89 BB Output 10 11 userNum = userNum / x 12 13 Put userNum to output 14 15 Put " to output Code Flowchart What is this? Coding trail of your work 1/17 M- ---3- -0--0 min:45 Latest submission - 7:59 PM EST on 01/17/22 Total score: 3/10 Only show failing tests Download this submission 1: Compare output A 0/4 Output differs. See highlights below. Special character legend Input 2000 2 Your output 25 6 10 Expected output 1000 500 250 125 2: Compare output A 3/3 Input 1004 Your output 25 6 10 3: Compare output A 0/3 Output differs. See highlights below. Special character legend Input 8000 - 2 Your output 25 6 10 Expected output -4000 2000 -1000 500
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
