answer.
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]
1 year 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]1 year 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
Write a method called makeStars. The method receives an int parameter that is guaranteed not to be negative. The method returns
serious [3.7K]

Answer:

// import the Scanner class

// to allow the program receive user input

import java.util.Scanner;

// The class Solution is defined

public class Solution{

   // main method to begin program execution

   public static void main(String[] args) {

       // scanner object scan is declared

       Scanner scan = new Scanner(System.in);

       // Prompt the user to enter a number

       System.out.println("Enter the number of stars you want: ");

       // user input is assigned to numOfStar

       int numOfStar = scan.nextInt();

       // call the makeStars method

       makeStars(numOfStar);

   }

   

   // makeStars method print stars using recursion

   // the method call itself till starNum == 0

   public static void makeStars(int starNum){

       if (starNum != 0){

           System.out.print("*");

           makeStars(starNum -1);

       }

   }

}

Explanation:

The code is well comment and solve the problem using recursion.

6 0
2 years ago
Why are smartphones and tablets capable of handling rich content and interactivity?
NikAS [45]

Answer:

Explanation:

With the advance in technology, smartphones, and tablets are built to meet the ever-increasing needs of users.

Smartphones are mobile phones that also have internet connectivity, they can be used to make calls and perform many tasks just like the conventional desktop. Smartphones and tablets are indeed considered computers because they also process inputs in form of commands and they produce outputs.

Smartphones and tablets are capable of handling rich content and interactivity because:

1. Wireless synchronization with other devices: Just like desktops, laptops, they can interact with other devices, and can receive and also send information doesn't matter the distance.

2. They have Internet connectivity.

3. They have strong hardware, good storage capacity.

4. They have inbuilt software and are capable of accepting other software and programs.

5. They are built with an appealing user interface.

6. Just as computers have processors, smartphones and tablets also have processors to ensure their speed at processing informations.

3 0
2 years ago
Digital cellphones use __________ to reduce the size of the channels that are required by scattering the digital fragments of co
Yuri [45]

Digital cellphones use Digital Compression to reduce the size of the channels that are required, by scattering the digital fragments of conversations over many channels

7 0
1 year ago
A signal travels from point A to point B. At point A, the signal power is 100 W. At point B, the power is 90 W. What is the atte
11Alexandr11 [23.1K]

Answer:

Attenuation = 0.458\ db

Explanation:

Given

Power at point A = 100W

Power at point B = 90W

Required

Determine the attenuation in decibels

Attenuation is calculated using the following formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Where P_s = Power\ Input and P_d  = Power\ output

P_s = 100W

P_d = 90W

Substitute these values in the given formula

Attenuation = 10Log_{10}\frac{P_s}{P_d}

Attenuation = 10Log_{10}\frac{100}{90}

Attenuation = 10 * 0.04575749056

Attenuation = 0.4575749056

Attenuation = 0.458\ db <em>(Approximated)</em>

7 0
2 years ago
3) 5, 10, 15, 20 are items of data. Explain how these could become information and what knowledge
yKpoI14uk [10]

For example when there is research on how many people shoplift in a shopping centre per week. These numbers could show a increase in the number of shoplifters per week.

8 0
1 year ago
Other questions:
  • Instructions:Type the correct answer in the box. Spell all words correctly.
    5·2 answers
  • Catherine wants to search online for fruit juices. She is fine with aerated or fresh fruit juices. Which Boolean operator will e
    12·2 answers
  • Greg is writing a report on becoming an advertising and promotions manager. Complete the report by correctly filling in the miss
    12·1 answer
  • Secure Wi-Fi networks and VPNs use _____ to secure data transferred over a network.
    13·1 answer
  • There are many different types of hardware devices, different manufacturers, and countless configuration possibilities. Explain
    14·1 answer
  • c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
    5·1 answer
  • What output is produced by the following program segment? Why? (Recall that name.charAt(i) is the i-th character in the string,
    11·1 answer
  • When a program has several modules calling other modules, programmers often use a program ____, which operates similarly to an o
    5·1 answer
  • 14.28. Consider the relation R, which has attributes that hold schedules of courses and sections at a university; R = {Course_no
    7·1 answer
  • A group of developers for a startup company store their source code and binary files on a shared open-source repository platform
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!