Write a c program to check whether a number entered by user


Part 1

1. Determine whether the following conditions are True or False?

x = 4, y = 20, z = 3.

A) x < y+z, B) x-y>= 1,

C) x != y,

D) z >12 ,

E) !(x < 3)

F) z-6 <= 6

G) x<1 || y>5

H) z<1 && z >2.

Note: Solve this by hand and show the calculations.

2. Write a C++ program to check whether a number entered by user is even or odd.

Pseudo code:
Read the number n;
if (n is divisible by 2),
Print "n is even";
else
Print "n is odd";

3. Write a C++ program to relate two integers entered by user using == or > or < sign.

Pseudo code:
Read values of 2 numbers a ,b;
if (a is equal to b),
Print "a=b";
else if (a is less than b),
Print "aelse if (a is greater than b),
Print "a>b";

Part 2

1. Write C++ statements for the following expressions,

1.1. Exp1 = a/b + c/d

1.2. Exp1 = am/bn

1.3. Exp1 = log(xr)

1.4. Exp1 = x2 +3x -10

1.5. Exp1 = {-b + √(b2-4ac)}/2a

2. Write a C++ program to convert degrees Kelvin to degrees Fahrenheit.

3. Write a C++ program to compute volume V of a sphere of radius r.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a c program to check whether a number entered by user
Reference No:- TGS01036504

Expected delivery within 24 Hours