Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Raj has n pens. If Raj keeps percentage p of the pens, the remaining will be shared among his friends. Write a Python program to
Raj has n pens. If Raj keeps percentage p of the pens, the remaining will be shared among his friends. Write a Python program to read the total number of pens, say it n.
Also read the percentage (p) of pens that Raj will keep with him.
Create a function[named share_YourRegistrationNumber] to Calculate the number of remaining pens (r) that will be shared among his friends.
If no pen is left for sharing display No pens left to share.
If percentage of pens fractional part is >=0.5 then raise the value to its higher integer and if it is <0.5 then lower the value to its lower integer. Input: First line contains the value of n Second line contains the value of p Output: The value of remaining pens(r) Constraints: 0p100 Otherwise print Percentage should be 0 to 100 n>=0 Otherwise print Pens should be >= 0
For example:
Test | Input | Result |
---|---|---|
1 | 30 14 | 26 |
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