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
Neko [114]
3 years ago
6

2.4 Code Practice: Question 1 write the code to input a number and print the square root. Use the absolute value function to mak

e sure that if the user enters a negative number, the program does not crash. Example: Enter a number: -16. Output 4.0​
Computers and Technology
2 answers:
Alekssandra [29.7K]3 years ago
5 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

//main function

int main()

{

   // variable

  int n;

  cout<<"enter a number:";

  // read the input

  cin>>n;

  // find the square root of the absolute value

  float square_root=sqrt(abs(n));

  // print the square_root

  cout<<"square root of "<<n<<" is: "<<square_root<<endl;

   return 0;

}

Explanation:

Read a number from user and assign it to "n".Then find its absolute value with abs() function.Then calculate the square root of the absolute value with sqrt() function.Print the square root of the number.

Output:

enter a number:-17

square root of -17 is: 4.12311

Svetllana [295]3 years ago
5 0

Answer:

import math

num=int(input("Enter a number: "))

x=math.fabs(num)

y=math.sqrt(x)

print(y)

Explanation: It will get the square root, then it will get the absolute value of the square root.

You might be interested in
Which icon will automatically adjust the amount of space between letters from very tight to very loose in style? Hyphenation, Te
tatuchka [14]
It's gonna be character spacing, as it allows you to customize how much space appears between characters.
5 0
4 years ago
Read 2 more answers
You suspect the hard drive is corrupted. Which window do you open to repair the drive?
vodomira [7]

Answer:

hi!

Explanation:

These are the steps that must be followed to repair the damaged hard drive without formatting and recovering the data:

Step 1: Run Antivirus Scan. Connect the hard drive to a Windows PC and use a reliable antivirus/malware tool to scan the drive or the system.  

Step 2: Run CHKDSK Scan.

Step 3: Run SFC Scan.

Step 4: Use a Data Recovery Tool.

4 0
3 years ago
Charts are often used in _____ to quickly represent data and help the readers understand the data.
ololo11 [35]

Answer:

Explanation down below :)

Explanation:

The answer is reports.. . hope that helped!

4 0
4 years ago
Which of these is NOT a benefit of trade?
Natasha_Volkova [10]

Answer:

<em>Creation of Dependencies</em> is not the only benefit of trade in the list.

Explanation:

People can provide the access to their resource with the help of trading, it will also increase the satisfaction of customer as he will be able to buy the product of his own choice with satisfactory price, as it breaks the monopoly of local producers.

There many disadvantages of the trade, such as it will create dependencies on other countries and local producers not be able to produce that products, this will lead to increase in imports and will increase the trade deficit of the country.

8 0
4 years ago
How is binary number related to real number?
Bogdan [553]

Answer:

.....................????..?..

7 0
3 years ago
Read 2 more answers
Other questions:
  • A(n) __________________ device is a breath analyzer on your vehicle that is electronically connected to the ignition.
    11·1 answer
  • What is plagiarism?<br> EXPLAIN IT
    15·2 answers
  • Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percen
    13·2 answers
  • What is the point of completing a value assessment while searching for a career
    11·1 answer
  • The average and distribution of properties, like orientation or color, over a set of objects or a region in a scene are called t
    12·1 answer
  • Which of the following about Java arrays is true?
    14·1 answer
  • The space between the margin<br> and start<br> of paragraph is called
    8·1 answer
  • Organizations following Waterfall methodology usually begin with requirements gathering, in which the development team attempts
    14·1 answer
  • How many different textile items would you find at a festival? (please list 5 items)
    7·1 answer
  • If ADD = 81, BAD = 49, and CAD = 64, then what is the value of ACA?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!