Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

What is considered personal use of a vacation rental property?

Answered: 1 week ago

Question

Name five ways that food production depends upon oil.

Answered: 1 week ago