click on this link......

LinkGrand.com

Saturday 30 March 2013

Questions on Decision making in c


1.
Ask the user to enter an integer. Find if it is even or odd. Print appopriate messages

2.
Write a Program that can calculate the area of a circle and the area of a square. When the program is started display the following prompt on the screen :
Area of Circle of Square (A, S)?
If the user enter A or A, then the program asks for the radius of the circle and calculates the area.

 3
ax2 +bx +c=0 is a quadratic equation. The discriminant of this equation is b2 –4 *a *c. Write a program to ask for the values of a, b and c calculate the roots of the quadratic equation.
If the discriminant is negative the equation has no real roots.
If the discriminant is zero, the equation has one real roots, -b /(2*a).
If the discriminant is positive, the equation has two roots given by the formula
        -b-Öb2-4*a*c                       -b+Öb2-4*a*c
              2*a                                     2*a

Give appropriate messages while displaying the roots of the equation.

 4
Write a program that can calculate the Volume and area of a sphere using the formulas
V=4 pr3 /3 and    A=4pr2 .  When the program is started, it should display the
Following prompt on the screen :
Volume of Sphere of Area of Sphere ( V,A)?
If the user enter V of v, then the program asks for the radius of the sphere and calculates the area.
If the user enters A or a, then program asks for the radius of the sphere and calculates the area.


 5
Write a program to display the message :
“Square root, square, cube (R/S/C)?”
Depending on what the user enters, calculate the values and print with appropriate messages.

 6
Ask the user to enter a the length in meters. The program must display a message on the screen, “Calculate length in centimeters, inches, or feet (C/ I /F) ?”. Depending on what the user chooses, calculate the corresponding length in centimeters, inches or feet and display the values with appropriate messages.


7
The relation between the voltage, current and resistance is given by the formula :
V= I * R
Write a program that displays the message :
“Calculate Voltage, Current of Resistance ( V / I / R)”,
If the user enters V or v, ask for values I and R and calculate the voltage.
If the user enters I of I, ask for values of V and R and calculate the current.
If the user enters R or r, ask for values of I and V calculate the resistance.


 8
Given the formula
PV = 0.37m (The+460)
Where p= pressure, pounds per square inch (psi)
            V= volume, cubic feet
             M=mass of air, pounds
               T= temperature, degrees Fahrenheit
Write a program that displays the message:
“calculate Pressure, Volume, Mass or Temperature (P/V /M/T) ? “.
If the user enters Por p, ask for values of v, M and T and calculate the pressure
If the user enters Vor v, ask for values P, M and T and calculate the volume.
If the user enters Mor m, ask for values of V, P and T and calculate the mass.
If the user enters Tor t, ask for values of V, M and P and calculate the temperature.

 9
Given the formula
C=(5/9)*(f-32)
Write a program to display the message :
“Calculate temperature in Celsius of Fahrenheit (C/F) ? “
Depending on what the user enters calculate the temperature and display with appropriate messages.

 10
Ask the user to enter an alphabetic character. If it is an uppercase character, ask for two numbers and calculate the average of them.
If it is a lowercase character, ask for three numbers and calculate the average of them.


No comments:

Post a Comment