CCS CSE 2112 Introduction to Programming
Programming Exercises -II
1. Rewrite the following mathematical expressions in C and write a simple program to
implement each.
a) (u v ) xw 2 b) ( x y) 3
c) |xy -w/z|
2. Write a program that prompts the user for the Cartesian coordinates of two points (x 1, y1)
and (x2,y2) and displays the distance between them using formula.
distance = ( x1 x2 ) 2 ( y1 y 2 ) 2
3. Write a program that takes radius of a closed cylinder from the user and calculates and
displays the diameter, the area and the volume of the cylinder.
4. Write a program that takes the days as input and outputs the months and days.
5. Write a program that converts centimetres into metres. Your program should ask a user to
enter length in centimetres then outputs the equivalent meters and centimetres.
6. Write a program that takes a four-digit integer from user and shows the digits on the
screen separately i.e. if user enters 7531, it displays 7,5,3,1 separately.