Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Control Statements
Programs on if, if-else and nested if-else
Amount>=5000 10%
Otherwise 5%
4. Write a program to check whether the given year is a leap year or not.
5. Write a program to evaluate student result by reading marks in three
subjects from user.
6. Write a program to check whether the candidate is eligible for voting or
not by accepting age value from user.
7. Write a program to check the given character is alphabet or not.
8. Write a program to calculate the salary of medical representative based on
the sales. Bonus and incentive to be offered to him will be based on total
sales. If the sale exceeds rs.100000/- follow the particulars of Table (1)
otherwise (2).
Table 1 Table 2
Basic = Rs.3000 Basic=rs.3000
Hra = 20% of basic Hra=20% of basic
Da = 110% of basic Da=110% of basic
Conveyance = Rs500 Conveyance=Rs.500.
Incentive=10% of sales Incentive=5% of sales.
Bonus=Rs.500 Bonus=Rs.200
Score Grade
>=90 A
80 – 89 B
70 - 79 C
60 - 69 D
<60 E
14. Write a program to calculate net amount by accepting amount value from
user.
1-1000 5%
>4000 25%
Programs on Switch-case
17. Write a program that checks whether a character entered by the user is a
vowel or not.
18. Write a menu driven program to find area of the circle, area of the triangle
and area of the rectangle according to users input choice.
19. Write a menu driven program to find 1. addition 2. subtraction 3.
Multiplication 4. Division 5.Remainder according to the users input choice.
20. Write a program to find sum of all individual digits in a given number.
21. Write a program to find sum of cubes of all individual digits in a given
number.
22. Write a program to find sum of even digits in a given number.
23. Write a program to find sum of odd digits in a given number.
24. Write a program to finds maximum digits in the given number.
25. Write a program to find minimum digit in the given number.
26. Write a program to find reverse of a given number.
27. Write a program to check whether the given number is palindrome or not.
28. Write a program to display each digits of a given number in words. [Ex:
Input: 3452 Output: Three Four Five Two.]
29. Write a program to display first ‘n’ numbers in the Fibonacci series.
[Fibonacci Series: 0 1 1 2 3 5 8 13 ........]
30. Write a program to check whether the given number is Armstrong number
or not.
Programs on do-while
31. Write a menu driven program to find area of circle, area of triangle & area
of rectangle and the program should accept the choice from user
repeatedly.
32. Write a menu driven program to find addition, subtraction, multiplication
& division of two given numbers and program should accept choice form
the user repeatedly.
33. Write a program to count number of digits in a given number.
49. Write a program to display the numbers between 1000 to 1100 whose
individual digits sum is exactly 9.
50. Write a program to display prime factors of a given number.
51. Write a program to find sum of prime factors of a given number.
52. Write a program to find count of prime factors of a given number.
53. Write a program to display the following pattern.
1
12
123
1234
12345
54. W.A.P to display the following pattern
1
12
123
1234
12345
55. W.A.P to display the following pattern.
12345
1234
123
12
1
56. W.A.P to display the following pattern.
12345
1234
123
12
1
57. W.A.P to display the following pattern
1
22
333
4444
55555
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
59. W.A.P to display the following pattern
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
5 10 15 20 25 30 35 40 45 50
60. W.A.P to display the following pattern.
1
24
36 9
4 8 12 16
5 10 15 20 25
61. W.A.P to display the following pattern
a
ab
abc
abcd
abcde
62. W.A.P to display the following pattern
a
ab
abc
abcd
abcde
63. W.A.P to display the following pattern.
abcde
abcd
abc
ab
a
64. W.A.P to display the following pattern.
abcde
abcd
abc
ab
a
65. W.A.P to display the following pattern.
a
bc
def
ghij
klmno
66. W.A.P to display the following pattern.
A
AB
ABC
ABCD
ABCDE
67. W.A.P to display the following pattern.
A
BC
DEF
GHIJ
KLMNO
68. W.A.P to display the following pattern.
A
BB
CCC
DDDD
EEEEE
69. W.A.P to display the following pattern.
*
**
***
****
*****
70. W.A.P to display the following pattern.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
*
**
***
****
*****
*********
*******
*****
***
1 1
1 2 1
1 3 3 1
1 4 6 4 1
121
12321
1234321
123454321
1 1
12 21
123 321
1234 4321
1234554321
***
*****
*******
*********
*******
*****
***
1
123
12345
1234567
123456789
1234567
12345
123
1
78. W.A.P to display the following pattern.
*
***
*****
*******
*****
***
*
0
10
010
1010
01010
1
01
101
0101
10101