![seonna](/avatars/42157.jpg)
seonna
02.10.2019 •
Computers and Technology
Write a program that asks the user to input an integer that is a perfect square. a perfect square is an integer that is equal to the product of another integer with itself; e.g., 16 is a perfect square because it equals 4 times 4. repeatedly force the user to input a new integer until they enter a perfect square. once the user has entered a perfect square, print its square root as an integer. hint: you can modulo a float by 1 to get the decimal part of the float, e.g., 2.75 % 1 equals 0.75, and 5.0 % 1 equals 0.
Solved
Show answers
More tips
- H Health and Medicine How to Treat Whooping Cough in Children?...
- H Health and Medicine Simple Ways to Lower Cholesterol in the Blood: Tips and Tricks...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
- S Style and Beauty How to Choose the Perfect Hair Straightener?...
- F Family and Home Why Having Pets at Home is Good for Your Health...
- H Health and Medicine How to perform artificial respiration?...
- H Health and Medicine 10 Tips for Avoiding Vitamin Deficiency...
Answers on questions: Computers and Technology
- M Mathematics Which statement is true? Question 7 options: A) |–3| = 3 and –|–4| = –4 B) |–3| = 3 and –|4| = 4 C) –|3| = 3 and |4| = 4 D) |–3| = 3 and |–4| = –4...
- M Mathematics Write each fraction as a percent. Use a model if needed. V-2 7/1021/253/518/25...
- H History How did francis cabot lowell attract women workers to his factories? (1 point) by hiring buses to transport them to and from work every day by offering higher wages than they earned...
- E English 1.) What does Hamlet mean when he tells Laertes, Free me so far in your most generous thoughts/That I have shot my arrow o er the house/And hurt my brother. ? A.) He is asking...
Ответ:
// program in python
# import math library
import math
#read input from user
num=int(input("enter an integer:"))
while True:
#find square root on input
s_root=math.sqrt(num)
#find remainder of root
r=s_root%1
#if remainder if 0 then perfect square
if r==0:
print("square root of the number is:",s_root)
break
else:
#if number is not perfect square then ask again
num=int(input("input is not perfect square !!enter an integer again:"))
Explanation:
Read an integer from user.Find the square root of the input number and then find the remainder of square root by modulo 1.If the remainder is 0 then number is perfect square otherwise ask user to enter an integer again until user enter a perfect square number.
Output:
enter an integer:12
input is not perfect square !!enter an integer again:16
square root of the number is: 4.0
Ответ:
1=120
2=30
3=100
Step-by-step explanation:
please give brainliest!