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
topjm [15]
4 years ago
7

Write the code to input a number and print the square root. Use the absolute value function to make sure that if the user enters

a negative number, the program does not crash.
Advanced Placement (AP)
1 answer:
lukranit [14]4 years ago
6 0

Answer:

Explanation:

Language?

I'm assuming this is AP CS A so I'll do it in java.

import java.util.Scanner;

class Main {

public static void main(String[] args) {

   Scanner input = new Scanner(System.in);

   System.out.print("Number: ");

   int sqrtNumber = Math.abs(input.nextInt());

   double printableNumber = Math.sqrt(sqrtNumber);

   System.out.println(printableNumber);

 }

}

You might be interested in
Explain how poverty plays a role in U.S. politics. Should play a stronger or weaker role in politics?
aivan3 [116]
Poverty plays a controversial role in U.S as some politicians would increase or cut taxes on benefits/aids for others. I know it’s not that much but hope this helps
4 0
3 years ago
Can snacking on fruit rather than candy reduce later food consumption?
olasank [31]

Answer:

Yes it can

Explanation:

6 0
2 years ago
Help ASAP due in 10 minutes AP!!! Marking Brainliest!!!
Digiron [165]

Answer:

1/2

Explanation:

7 0
3 years ago
Read 2 more answers
What was the relationship between Muslim and Christians in the early period of the Muslim civilization
Agata [3.3K]
They tolerated each other
8 0
3 years ago
Read 2 more answers
The study of human geography includes sub-branches in all of the following areas EXCEPT
Nataly_w [17]
A- geology deals with the environment (also its the odd one out)
5 0
3 years ago
Other questions:
  • A 3/b=c solve for chow would i solve this to get c?
    11·1 answer
  • Give three reasons why children need socioemotional development
    14·1 answer
  • Which of the following areas is MOST likely to experience a high death toll from a tsunami?
    9·1 answer
  • What is the educated guess of the answer to a question called?
    14·2 answers
  • At an equal distance from the extremities of something
    7·1 answer
  • THIS IS A SCIENCE QUESTION
    14·1 answer
  • The articles of confederation established a strong central government to respond to issues of economic and national crisis. True
    8·1 answer
  • Which of the following pollutants are most likely the result of a malfunctioning chimney?
    8·2 answers
  • How many steps in marcotting?​
    10·1 answer
  • Your friend has recently been diagnosed with major depression. He heard that there are many treatment options but does not know
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!