Docsity

C Programming Exercises, Quizzes of Computer Science

Toggle sidebar
bg1
1. Write a C program to calculate f, ask the user to enter x, y, and z variables
where
f=
√
2xy
x2+y2+
√
2xz
(2x¿¿2+4z2)2¿
2. Write C program to calculate area, perimeter, Surface area and Volume of
the cylinder. Ask the user to enter the radius and height where:
area=π r2
perimeter=2πr
Surface area = 2
πr(r+h)
Volume=π r 2h
3. Write a C program to ask the user to enter two numbers and check the
relational expression between the two numbers
4. Write a program that inputs three different integers from the keyboard,
then prints the sum, the average, the product, the smallest and the largest
of these numbers.
5. Given the equation
y=a x3−b x2−6
, which of the following, if any, are correct
C statements for this equation?
a. y = a * x * x * x – b * x * x - 6;
b. y = a * x * x * x * b * x * x - 6;
c. a * (x * x * x ) – b * x * x * ( - 6 );
d. a * (x * x * x ) – b * (x * x) - 6;
1
pf2

Partial preview of the text

Download C Programming Exercises and more Quizzes Computer Science in PDF only on Docsity!

1. Write a C program to calculate f, ask the user to enter x, y, and z variables

where

f =

2 xy

x

2

  • y

2

2 xz

( 2 x

¿ 2 + 4 z

2

2

2. Write C program to calculate area, perimeter, Surface area and Volume of

the cylinder. Ask the user to enter the radius and height where:

area = π r

2

 perimeter = 2 πr

 Surface area = 2

πr ( r + h )

 Volume = π r

2

h

3. Write a C program to ask the user to enter two numbers and check the

relational expression between the two numbers

4. Write a program that inputs three different integers from the keyboard,

then prints the sum, the average, the product, the smallest and the largest

of these numbers.

5. Given the equation

y = a x

3

− b x

2

, which of the following, if any, are correct

C statements for this equation?

a. y = a * x * x * x – b * x * x - 6;

b. y = a * x * x * x * b * x * x - 6;

c. a * (x * x * x ) – b * x * x * ( - 6 );

d. a * (x * x * x ) – b * (x * x) - 6;

e. a * x * x * x – (b * x * x - 6 );

f. (a * x * 3 – b * x * 2 ) - 6;