Practice Sheet
1. Add, subtract, multiply or divide two integers. Read and display your name.
2. Calculate the area of a triangle, circle, rectangle.
3. Convert the given temperature in Fahrenheit to Celsius and vice versa.
4. Convert given days into year and month and display the result.
5. Determine whether a given year is leap year or not.
6. Calculate factorial of a given number.
7. Calculate and display all prime numbers between any two integers.
8. Interchange the value of a, b and c.
9. Sort a list of numbers in ascending / descending order and hence print them. Also print the
maximum and minimum number.
10. Read the components of A = a1 i + a2 j + a3 k and B = b1 i + b2 j + b3 k and display the result of
their dot/cross product.
11. Write a C program that will read the components of two three dimensional vectors and display the
components of their cross product.
12. Read and display a matrix and its transpose.
13. Add and subtract two same size matrices and display the result.
14. Display all the diagonal element of a square matrix in matrix form.
15. Display all the elements except the diagonal element of a square matrix.
16. Calculate and display the trace of a square matrix.
17. Read and calculate the value of a 3×3 determinant.
18. Multiply two matrices (if possible) and display the result.
19. Read a few number of integer and calculate the sum and mean of those integers.
20. Read the values of P and Q and print that are divisible by 5 and 7 (/5 or7), where P and Q
are integers and P<Q.
21. Read the total monthly consumption and compute the monthly electric bill of a household.
Given the rate of electricity is Tk. 2.50 per unit for first 100 units, Tk. 4.00 per unit for the
next 100 units and Tk. 7.00 per unit for above 200 units. There is also a line rent of Tk. 120
per month and 15% tax on the total number of units consumed.
22. The commission on a salesman’s total sales is as follows:
(i) If sales Tk. 100, then there is no commission.
Page 1 of 2
(ii) If 100 sales Tk. 500, then commission=10% of sales.
(iii) If sales Tk. 500, then commission=Tk. 50+15% of sales above Tk. 500.
Read the salesman’s total sales and calculate the commission.
23. Determine the following: [use for loop and do while loop]
(a) 1+2+3+ … … +n; (d) 1+3+5+ … … +2n-1;
(b) 12 + 22 + 32 + … … + n2 ; (e) 2+4+6+ … … +2n;
(c) 13 + 23 + 33 + … … + n3 ;
24. Display Floyd's triangle
1
2 3
4 5 6
7 8 9 10
… … … … …
25. Display Fibonacci series : 0 1 1 2 3 5 8 13 21 34 .
26. Read obtained mark of a course between 1 and 100 and calculate the grade as follows:
Mark ≥ 80 ‘A+’; Mark ≥ 75 ‘A’; Mark ≥ 70 ‘A-’;
Mark ≥ 65 ‘B+’; Mark ≥ 60 ‘B’; Mark ≥ 55 ‘B-’;
Mark ≥ 50 ‘C+’; Mark ≥ 45 ‘C’; Mark ≥ 40 ‘D’;
Mark ≤40 ‘F’.
Using switch statement.
27 Write a C program to read the values of two integers and calculate their Least common
multiple and Greatest common divisor.
28 Compute the roots of a quadratic equation: ax 2 + bx + c = 0 ; a 0 .
29 Identify the nature of the conic: ax2 + 2hxy + by2 + 2 gx + 2 fy + c = 0 .
Also
2 print the value of ab − h 2 and = a b c + 2 f g h − a f 2 − b g 2 − c h 2 .
30 Read the values g , f and c of the circle x2 + y 2 + 2 gx + 2 fy + c = 0 and then calculate the
radius and centre of the circle.
31 Add, subtract, multiply or divide two integers using user defined function.
32 Circle area and gcd of two integers using user defined function.
https://www.geeksforgeeks.org/c-programming-language/
https://www.w3schools.com/c/c_functions.php
Page 2 of 2