2. Write a program to input a number x from the keyboard. If the number is larger than 0, find its square root. Otherwise, calculate x* x. Write the program by using selection statement. A sample of...

Write a C program2. Write a program to input a number x from the keyboard. If the number is larger than 0,<br>find its square root. Otherwise, calculate x* x. Write the program by using selection<br>statement. A sample of the output showed as below.<br>Please enter a positive or negative number: -4<br>You have entered -4 which is smaller than 0<br>Therefore -4 x -4 = -8<br>Hint: Use include <math.h> to include sqrt function.<br>Example: root=sqrt(x);<br>

Extracted text: 2. Write a program to input a number x from the keyboard. If the number is larger than 0, find its square root. Otherwise, calculate x* x. Write the program by using selection statement. A sample of the output showed as below. Please enter a positive or negative number: -4 You have entered -4 which is smaller than 0 Therefore -4 x -4 = -8 Hint: Use include to include sqrt function. Example: root=sqrt(x);

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here