Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ask the user to enter the numerator and denominator of a fraction, and the position of the decimal digit they want to know. For
Ask the user to enter the numerator and denominator of a fraction, and the position of the decimal digit they want to know. For Example, if the user enters a numerator of 1 and a denominator of 7 and wants to know the 4th digit after decimal point, your program should print out 8, because 1/7 = .142856... and 8 is the 4th digit after decimal point. One way to do this is to mimic the long division process you may have learned in grade school. It can be done in about five lines using the // operator at one point in the program. Hint: In order to find the first digit of any number, it is only needed to find the reminder of that number by 10. For example, 1275 % 10-5 which is the first digit of 1275. Bonus Chance: If you write this code without any loop, you will get 5% bonus of the mark of this assignment. Please mention it in your solution that this is the bonus part. Below is the expected output of the code for some example: Enter the numerator: 93 Enter the denominator: 26 Enter the position of the decimal digit that you want: 3 The answer of the division is: 3.57692307692 6 is placed in position 3 after decimal point.. Programmed by Stew Dent. Date: Mon Sept 6 20:00:41 2021 End of processing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started