PPS Assignment-1
1. Create GitLab Account and create a folder with your Roll Number in Programming for Problem
Solving Directory.
2. Create a new file
. io.c using gedit or vim or vi editor. Write C statement(s) in io.c which
produces the following output.
Σ
a. Good day!
b. Good day!
c. He shared his “wisdom” with me
d. Hello
world! (using a single printf statement)
e. Hello
world! (using a single printf statement that has no blank space)
f. How are
you?
I am OK.
g. How are you?
I am OK. (using two printf statements which have no blank spaces)
h. How are you?
I am OK. (using a single printf statement that has no blank space)
i. Something has gone crazy (with a beep sound)
j. Bank interest is 10% in the year 2001.
3. Write a C program Pattren.c that produces the following output
*********
* *
* *
* *
* *
* *
* *
* *
* *
*********
4. Write a C program interest.c that calculates the total interest income on amount Rupees
5 lakhs in a period of 10 years. Show the results for simple interest, compounded
interest when the compounding is done annually, semi-annually, quarterly, monthly and
daily. Assume that the interest rate is 3.5% per year.
Expected output:
Simple interest on Rs. 500000.00 in 10 years = Rs. 175000.00
Interest on Rs. 500000.00 in 10 years compounded annually = Rs. 205299.38
Interest on Rs. 500000.00 in 10 years compounded semi-annually = Rs. 207389.10
Interest on Rs. 500000.00 in 10 years compounded quarterly = Rs. 208454.42
Interest on Rs. 500000.00 in 10 years compounded monthly = Rs. 209172.41
Interest on Rs. 500000.00 in 10 years compounded daily = Rs. 209521.87
5. Write a C program cmtoinch.c that accepts a distance in inches and prints the
corresponding value in cms. Note that 1 inch = 2.54 cm.
Test data and expected output:
Enter the distance in inches:3 Distance 3.00
inches is = 7.62 cms
6. Write a C program swap.c that reads two values from the keyboard, swaps their values
and prints out the result.
Test data and expected output:
Enter two real values to be swapped:2.4 5.7 Values entered are
a=2.400000 and b=5.700000
Values after swap are a=5.700000 and b=2.400000
7. Write a C program temp.c that accepts a temperature in Fahrenheit and prints the corre-
sponding temperature in Celsius.
.
C/5 = (F − 32)/9
Σ
Test data and expected output:
Enter temp in Farenheit:98.4
Temp 98.40 in Farenheit = 36.89 Centigrade