Question: Write a program to convert a fraction to a decimal. Have your program ask for the numerator first, then the denominator. Make sure to check
Write a program to convert a fraction to a decimal. Have your program ask for the numerator first, then the denominator. Make sure to check if the denominator is zero. If it is print out "Cannot divide by zero."
Hint: Since this lesson uses ifelse statements, remember to use at least one ifelse statement in each of your answers to receive full credit.
Sample Run
Enter the numerator:
Enter the denominator:
Sample Output
Cannot divide by zero.
Sample Run
Enter the numerator: Enter the denominator:
Sample Output
Decimal:
Write a program to convert a fraction to a decimal. Have your program ask for the numerator first, then the denominator. Make sure to check if the denominator is zero. If it is print out "Cannot divide by zero."
Hint: Since this lesson uses ifelse statements, remember to use at least one ifelse statement in each of your answers to receive full credit.
Sample Run
Enter the numerator:
Enter the denominator:
Sample Output
Cannot divide by zero.
Sample Run
Enter the numerator: Enter the denominator:
Sample Output
Decimal:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
