Sei sulla pagina 1di 10

VNRVJIET - T&P Programming Practice in C by K V Ramana

Control Statements
Programs on if, if-else and nested if-else

1. Write a program to find maximum in the given three numbers.


2. Write a program to check whether the given number is even or odd.
3. Write a program to calculate net amount by accepting amount value from
user.

Amount (Rs) Discount (%)

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

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

9. Write a program to check whether the given number is positive or


negative or zero.
10. Write a program to find the roots of a quadratic equation by accepting
coefficients of variables.
11. Write a program to evaluate result of a student by accepting marks in
three subjects. If a student secure marks greater than 35 in all subjects
then the result is pass otherwise fail. Assign grades to the passed students
based upon the following conditions:
Avg>=60 => grade = ‘A’
Avg>=50 and avg<60 => grade = ‘B’
Otherwise => grade = ‘C’
12. Write a program to perform calculator operations addition, subtraction,
multiplication and division (+, -, *, / ) on given two numbers.
13. Write a program to evaluate grade according to the score secured by a
student.

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.

Amount (Rs) Discount (%)

1-1000 5%

1001 – 2000 10%

2001 – 3000 15%

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

3001 – 4000 20%

>4000 25%

15. Write a program to sort three given numbers in ascending order.

Programs on Switch-case

16. Write a program to carry out the arithmetic operations addition,


subtraction, multiplication, and division between to variable values.

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.

Programs on While Loop

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.

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

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.

Programs on for loop

34. Write a program to find factorial of a given number.


35. Write a program to display even number between 1 to 50.
36. Write a program to display odd numbers between the given range.
37. Write a program to find sum of even numbers, count of even numbers, sum
of odd numbers and count of odd numbers between 1 to 20.
38. Write a program to display nth multiplication table.
39. Write a program to find factors of a given number.
40. Write a program to find the count of factors of a given number.
41. Write a program to find the sum of factors of a given number.
42. Write a program to check whether the given number is prime number or
not.
43. Write a program to display the numbers between 1 to 20 which are
divisible by only 3, only 5 and by both 3 and 5.

Programs on nested for loop

44. Write a program to display first n multiplication tables.


45. Write a program to display Armstrong numbers between 100 to 999.
46. Write a program to display prime numbers between 1 to 100.
47. Write a program to find the count of prime numbers between 1 to 50.
48. Write a program to find the sum of prime numbers between 1 to 20.

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

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

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

58. Write a program to display the following pattern.

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

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

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

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

71. W.A.P. to display the following pattern.

*
**
***
****
*****

72. W.A.P to display the following pattern.

*********

*******

*****

***

73. W.A.P to display the Pascal triangle.

1 1

1 2 1

1 3 3 1

1 4 6 4 1

74. W.A.P to display the following pattern.

121

12321

1234321

123454321

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

75. W.A.P to display the following pattern

1 1

12 21

123 321

1234 4321

1234554321

76. W.A.P to display the following pattern.

***

*****

*******

*********

*******

*****

***

77. W.A.P to display the following pattern.

1
123
12345
1234567
123456789
1234567
12345
123
1
78. W.A.P to display the following pattern.

*
***

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in


VNRVJIET - T&P Programming Practice in C by K V Ramana

*****
*******
*****
***
*

79. W.A.P to display the following pattern.

0
10
010
1010
01010

80. W.A.P to display the following pattern.

1
01
101
0101
10101

For any doubts contact Mr K V Ramana Mail Id: venkataramana_k@vnrvjiet.in

Potrebbero piacerti anche