0% found this document useful (0 votes)
9 views1 page

Exercise 2

Uploaded by

amosmaina830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Exercise 2

Uploaded by

amosmaina830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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.

You might also like