1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mezya [45]
3 years ago
14

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.
Computers and Technology
1 answer:
BlackZzzverrR [31]3 years ago
3 0

Answer:

// 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    

You might be interested in
¿que lenguaje de programacion usan los operadores matematicos?​
kolbaska11 [484]

Answer:

Matlab / GNU Octave. MATLAB (laboratorio de matrices) es un entorno informático numérico multiparadigma y un lenguaje de programación de cuarta generación.

Explanation:

8 0
3 years ago
Read 2 more answers
Write a function in Erlang called func that takes a list of tuples and returns a new list consisting of tuples from the original
vovikov84 [41]

Answer:

Please find the complete question in the attached file.

Explanation:

Following are the code to the given question:

-module(helloworld)//use a module

-export([start/0])

start() ->//start module

func([Head Taill) ->//defining a method func that takes a parameter

{

first, second} = Head,//holding head value

if //defining if block

first > second -> func(Tail)//method func that takes a parameter

true ->

[first, second}|func(Tail)]//method func that takes a parameter

end

6 0
3 years ago
Driswers.
Leokris [45]

Answer:

Developers don't need a special program to view or edit it.

It makes markup languages independent of hardware and software

Explanation:

Markup just means that it's easily readable by humans. However, you'll often need specific software to be able to edit it, as opposed to plaintext, which could be edited in notepad.

3 0
3 years ago
Read 2 more answers
Inputs should be blue colored font and should have ________ only. process and outputs should be in black colored font and have _
maksim [4K]

Inputs should be blue colored font and should have hardcoded numbers only,  and process and outputs should be in black colored font and have  formulas only.

<h3>What does input implies?</h3>

The term input is one that connote when a thing such as power or a  signal, is known to be put into any machine or system.

Note that Inputs should be blue colored font and should have hardcoded numbers only,  and process and outputs should be in black colored font and have  formulas only.

Learn more about Inputs from

brainly.com/question/20489800

#SPJ2

7 0
2 years ago
write a function interest() that takes one input, a floating-point interest rate (e.g., 0.06, which corresponds to a 6% interest
Novay_Z [31]

Code:

def interest():

   interest_rate = 0.06

   investment = input(int('Investment: '))

   yield = 0

   year = 0

   while (yield < investment):

       year += 1

       yield  = investment * interest_rate

   print (year)

NOTE: i wrote this code assuming that the investment for the next year is the same as the first year and so forth

8 0
3 years ago
Other questions:
  • Multiple choice
    9·2 answers
  • Chandra, a student working on a group project, is trying to decide how to have the whole group suggest revisions for an essay. S
    10·1 answer
  • In a flow chart, both the decision structure and the repetition structure use the diamond symbol to represent the condition that
    9·1 answer
  • Write a function with two parameters, prefix (a string, using the string class from ) and levels (an unsigned integer). The func
    14·1 answer
  • I. portability II. reusability III. inheritance IV. method V. data A. a new class can automatically pick up data and methods of
    14·1 answer
  • What type of device is the keyboard?<br><br> Output<br> Input<br> Monitoring<br> Software
    7·2 answers
  • How can I unblock Brainly?
    12·2 answers
  • For local patterns that change quickly, these methods are preferred 1. data driven 2. model drive 3. trend and seasonality drive
    10·1 answer
  • Which pane is used to modify the actual content of the SmartArt graphics as opposed to the layout and design?
    8·1 answer
  • Layer 4 security and application services, including server load balancing, Secure Sockets Layer (SSL) offloading, firewalling,
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!