You are on page 1of 2

Basics of Computer Programming

Practical: 1
Programs using printf statements:
1. Write a program that will display “hello” on the screen.
2. Write a program to print your name, Date of birth, address, education detail (print your
biodata.
3. Write a program to print subject code and subject name of your current semester subjects.
4. Write a Program to print block E using asterisks (*) where the E has height of seven
characters and a width of five characters.
5. Write a program to print “HELLO” in big block letters; each should have a height of seven
characters & width of five characters.
6. Write a program to print following patterns using printf.

I. * II. ***** III. 1


** **** 12
*** *** 123
**** ** 1234
***** * 12345

IV. 54321 V. * VI. * * * * *


5432 * * * * * *
543 * * * * * *
54 * * * * * *
5 * * * * * *

Computer Department (GIA) L. A. Bhavnani


Basics of Computer Programming
Practical: 2
Programs using Constant, Variables and data types
1. Write a program to demonstrate the variable declaration, initialization and printinting
of the values.
2. Write a program to compute the area of a rectangle with a width of three inches & a
height of five inches.
3. Write a program to calculate area of a circle having radius of three.
4. Write a program to display addition, subtraction, multiplication and division of two
numbers.

5. Write a program that deliberately makes the following mistakes.


a. Prints a floating point number using the %d conversion
b. Prints an integer using the %f conversion
c. Prints a character using %d conversion.
Note: Write following program using scanf () function.Use type conversion if required.
6. Write a program to calculate the volume of sphere. 4/3 PI r3 (Use define for PI)
7. Write a program that prints the perimeter of a rectangle given its height & width.
Perimeter = 2*(height + width)
8. Write a program to find volume of cylinder using V=PI r2h.
9. Write a program to enter marks of 3 subjects. Find and display total marks and
percentage of a student.
10. Write a program to calculate simple interest using SI= (prn)/100.
11. Write a program to read the price of an item in decimal form (like 15.95) and print the
output in paisa (like 1595 paisa).
12. Write a Program that converts the given temperature in Fahrenheit to Celsius.
C= (5/9) x (F-32)
12. Write a program that takes hours & minutes as input, then outputs the total number of
minutes (1hour 30 minutes = 90 minutes)
13. Write a program that takes an integer as the number of minutes & outputs the total
hours & minutes (90 minutes = 1 hour 30 minutes)
14. Write a program to interchange (swap) any two numbers with using third variable.
15. Write a program to interchange (swap) any two numbers without using third variable.

Computer Department (GIA) L. A. Bhavnani

You might also like