Ask the user to enter the numerator and denominator of a fraction, and the position of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
C) Use the appropriate Maxwell relation and determine whether the specific heat capacity at constant pressure (Cp) is a function of pressure at onstant temperature for: i) An ideal gas ii) [6 marks]...
-
What is considered personal use of a vacation rental property?
-
Why is a Walden reductor always used with solutions that contain appreciable concentrations of HCl?
-
Describe some of the fields or disciplines that are expected to be influenced by the development of workable and widely available quantum computers.
-
Cayemberg Company maintains a checking account at the Commerce Bank. At July 31, selected data from the ledger balance and the bank statement are shown below. Analysis of the bank data reveals that...
-
(2 pts) Starting with the following BST, 5 . 10 do a right rotation on 7, then a left rotation on 5, then a right rotation on 8. After those three rotations, draw the resulting BST. Which node in the...
-
Solve the systems 2- = (0) 2 ! *xx + 1x5.0 = 12 x2/= - 271 - 0.52 ; () =
-
Divide. (3x+28x+53)+(x+7) Your answer should give the quotient and the remainder.
-
6 2 Solve for x and check your answer: your answer: 4+- x-5x-5
-
Make an appropriate substitution and solve the equation. p (p -2)= p+6 The solution set is +6+233 +1 2
-
Add and write the result in standard form. (15x29) + (-8.3x3 14.7x217)
-
Simplify. (6x) Assume that the variable represents a positive real number.
-
1. What evokes consumers' "engagement" on a brand page on Facebook? 2. What attracts consumers to "like" a brand page on Facebook?
-
If there is an unrealized holding gain on available-for-sale investments, it is reported as?
-
List the six IT business objectives.
-
How is IT contributing to the success of the on-demand and shared economies?
-
Name four disruptive business models and describe what they offer to their customers.
Study smarter with the SolutionInn App