This document contains descriptions of 43 different programs involving basic mathematical and logical operations. The programs include calculating addition, average, various calculations based on user input, area and circumference calculations, finding largest/smallest of input values, checking even/odd, leap year, grades calculation, discounts, electricity bill calculation, a basic calculator, number checks, distance conversions, number patterns, prime numbers, Armstrong numbers, factorials and more using basic programming constructs like if-else ladders, switch cases, loops and functions.
Presiding Officer Training module 2024 lok sabha elections
c language programing
1. 1. WAP to calculate addition of two given values and display result on output screen. [without scanf( )].
2. WAP to calculate average of 5 given float values and display result on output screen. [without scanf( )].
3. WAP to take input for two user-defined values and perform following calculations. [take i/p using scanf( )].
- add=a+b
- sub=a-b
- mul=a*b
- div=a/b
4. WAP to calculate area of circle and circumference of circle according to value of radius given as input.
[Area=3.14*R*R ] [Circumference=2*3.14*R].
5. WAP to calculate area of rectangle and perimeter of rectangle according to value of length & breadth given
as input. [Area=L*B ] [Perimeter=2*(L+B)].
6. WAP to calculate simple interest according to value of principle, rate of interest & no of years given as
input. [SI = (p*r*n)/100].
7. WAP to convert temperature from Celsius to Fahrenheit. [F=(C*1.8)+32]
8. WAP to calculate volume of cylinder according to radius & height entered as input. [V=3.14*R*R*H].
9. WAP to swap values of two variables using third variable.
10. WAP to swap values of two variables without using temp.
11. WAP to check whether number entered is even or odd.
12. WAP to find largest number from 2 numbers entered as input.
13. WAP to find smallest from 2 numbers entered as input.
14. WAP to check whether year entered is leap year or not. [The year entered as input should be of four digits].
15. WAP which takes marks of 5 subjects & roll-no as input and calculate total & percentage also print result in
terms of [distinction (>=70) , first-class(>=60 & <=70),second-class(>=50 & <=60),pass-class(>=45 &
<=50) else fail]. [elseif ladder]
16. A cloth showroom has announced the following discounts on purchase of cloth worth Rs as follow:-
If purchase amount if less than 50 customer will not get any discount.
Display amount before discount, discount offered & amount after discount to be paid by customer.
PURCHASE AMOUNT DISCOUNT RATES
51 – 100 5%
101-200 7.5%
201-300 10%
Above 300 15%
17. An electric power distribution company charges its customer as follow:
Take input for customer number & consumption units.
Consumption Units Rates of charge
0-200 Rs. 0.50 per unit
201-400 Rs 100 plus Rs 0.65 per unit excess of 200
401-600 Rs 230 plus Rs 0.80 per unit excess of 400
601 and above Rs 390 plus Rs 1.00 per unit excess of 600
2. 18. WAP to create choice based calculator which takes input for two values and performs calculation for [+,-,*,
/]. [switch case & else if ladder].
19. WAP to check whether number entered is positive, negative or zero.
20. WAP to create choice based converter which takes input for distance in kM and carries conversion to [m,
cm, mm, feet & inch]. [switch case][make use of goto statement]
21. WAP to find largest from 3 numbers entered as input. [elseif ladder & nesting]
22. WAP to find smallest from 3 numbers entered as input.
23. WAP to print series of odd numbers from 1 to n terms find summation and count.
24. WAP to print series of even numbers from 2 to n terms. Find summation and count.
25. WAP to print series 1,4,9,…..n terms
26. WAP to print series 1,11,111,…..n terms
27. WAP to print series 1, 8, 27……n terms.
28. WAP to print series 21, 24,27 …..n terms.
29. WAP to print series 2-4+6-8…..n terms.
30. WAP to print Fibonacci series 1,1,2,3,…n terms
31. WAP to print power of number entered as input.
32. WAP to find factorial of number entered as input.
33. WAP to print following patterns upto n terms.:-
1 1 1234 4444 1
12 22 123 333 23
123 333 12 22 456
1234 4444 1 1 78910
4 4321 A A ABCD DDDD
43 321 AB BC ABC CCC
432 21 ABC DEF AB BB
4321 1 ABCD GHIJ A A
DCBA 1234 4 A 1 1
DCB 234 34 BB 1 2 1 01
DC 34 234 CCC 1 2 3 2 1 101
D 4 1234 DDDD 1 2 3 4 3 2 1 0101
A 12321
ABA 121
ABCBA 1
ABCDBCA
34. WAP to find number entered as input is prime or composite.
35. WAP to check number entered as input is ARMSTRONG or not.
36. WAP to check number entered as input is PERFECT number or not.
37. WAP to reverse the number entered as input.
38. WAP to find sum of digits for number entered as input.
39. WAP to check number entered as input is palindrome or not.
40. WAP to print series of odd numbers using while loop statements.
41. WAP to print series of even numbers using do….while loop statements.