0% found this document useful (0 votes)
6 views13 pages

All Assignment

assignment

Uploaded by

muzeemsaifi88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views13 pages

All Assignment

assignment

Uploaded by

muzeemsaifi88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

If Statement

1. WAP to accept a number from user and display it is a Negative number or


Positive number.
2. WAP to accept a number from user and display it is an Even number or Odd
number.
3. WAP to accept two numbers and display the Greater one out of two.
4. WAP to accept a number and display it is a multiple of 8 or not.
5. WAP to accept a number and display it is a factor of 48 or not.
6. WAP to accept Selling Price and Cost Price of an Item and Display it is Profit
or Loss.
7. WAP to accept age of a person and display whether the person is eligible for
Voting or not.
8. WAP to accept Selling Price and Cost Price of an Item. In case of Profit,
display Profit Amount and Profit Percent otherwise display Loss amount and
Loss Percent.
9. WAP to input Year from user. Display whether the year is a leap year or not.
10. WAP to accept an alphabet from user. If it is Capital, convert it to small
and if small then convert to capital.
11. WAP to accept temperature in Celsius. Convert and display it in
Fahrenheit
Where formula for temp. Conversion is C = F - 32
5 9
12. WAP to accept a number from user. If number is greater than 20, display
its Square otherwise display its Cube.
13. A banker gives and Interest rate of 4.5%, if amount is deposited for up
to 4 years otherwise gives an Interest rate of 7.25%. WAP to accept amount
Deposited and time in years and Display the Amount received after specified
years.
14. WAP to check whether a triangle is valid or not, when the three angles
of the triangle are entered through the keyboard. A triangle is valid if the sum
of all the three angles is equal to 180 degrees.
15. WAP to accept three sides of a Triangle and display it is a Pythagoras
Triplet or not.
16. WAP to accept two distances in feet and inches. Add the two distances
to give total distance in feet and inches.(Hint: 12 inches = 1 feet)
17. WAP to accept two dates (Current and Date of Birth) in DD MM YYYY
format. Calculate and display the age of person on Current Date in years ,
months and days.( Hint: 30 days = 1 month and 12 month=1 year)
18. A Company pay its employees as per the given criteria
If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and
DA = 90% of basic salary.
If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and
DA = 98% of basic salary.
If the employee's salary is input by the user write a program to find his gross
salary.
Where gross salary = basic salary + DA + HRA
19. WAP to accept three numbers and display the greater one.
20. WAP to accept marks of 5 subjects out of 100 each and display the grade
scored as per the given condition
Percentage Grade
>=90 A
<90 and >=75 B
<75 and >=60 C
<60 and >=33 D
<33 E
21. WAP to accept age of a person and display the Age Group as per the
given condition.
AGE AGE GROUP
<5 Baby
>5 and <=12 Child
>12 and Teenager
<=19
>19 and Youth
<=30
>30 and Young
<=45
>45 and Adult
<=59
>59 Senior Citizen
22. WAP to accept a number from 1 to 7 and display corresponding week
starting from SUNDAY.
23. WAP to accept a number from 1 to 12 and display Corresponding month.
24. A Banker offers an Interest rate as per the given Criteria
Time in Years Interest Rate
<=5 6.5 %
>5 and <=10 9.0 %
>10 and <=20 12.0 %
>20 18.0 %
WAP to accept amount deposited and time in years of depositing. Calculate
and display the Interest earned in Rs. Also Display the Amount received after
the specified time.
25. A Shopkeeper offers discount as per the given criteria on Purchase
Amount
Purchase Discount rate
Amount
<=5000 5%
>5000 and 8%
<=10000
>10000 and 12%
<=25000
>25000 and 17 %
<=50000
>50000 23 %
WAP to accept purchase amount from user. Calculate and display Discount in
Rs. Also display the Amount to pay after discount.
26. Any character is entered through the keyboard, WAP to determine
whether the character entered is a capital letter, a small case letter, a digit or a
special symbol. The following table shows the range of ASCII values for
various characters.
27. WAP to accept the current reading and last month reading of an
Electricity meter. Calculate and display amount to pay as Electricity Bill as per
the given criteria.
Units Consumed Rate per Unit
<=200 Rs 4.50 per unit
>200 and <=500 Rs 6.00 per unit
>500 and <=1000 Rs 9.00 per unit
>1000 Rs 15.00 per unit
28. A Courier company charges for courier as per the given Rate.
Weight of Rate Charged
Courier
<= 1 KG 100 /-
Next 5 KG 8 /- per KG
Next 5 KG 5 /- per KG
Next 5 KG 3 /- per KG
Remaining 2 /- per KG
WAP to accept weight of courier in KG and display amount to be paid as
courier charge.
29. WAP to accept Basic Salary of a person. Calculate and Display Income
Tax to pay as per given Criteria.
Annual Salary Income Tax
<=250000 0
>250000 and 10 %
<=500000
>500000 and 20 %
<=1000000
>1000000 30%

Where
Annual salary = Monthly Salary * 12
Monthly Salary= Basic Salary + DA + HRA – PF – INS
DA(Dearness Allowance) = 115 % of Basic Salary
HRA(House Rent Allowance) = 25 % of Basic Salary
PF(Provident Fund) = 10 % of Basic Salary
INS(Insurance) = 12 % of Basic Salary
SWITCH Statement
30. WAP to accept a number from 1 to 7 and display the corresponding
weekday starting from Monday.
31. WAP to accept a number from 1 to 12 and display the corresponding
Month.
32. WAP to accept two numbers and an Arithmetic Operator from user.
Perform the operation on two numbers as per the operator entered.

33. Write a Menu based program to accept a choice from user and as per the
choice, perform any one of following.
 Area of Square
 Area of Rectangle
 Area of Circle
 Area of Triangle(Heron’s Formula)
34. Write a Menu based program to accept a choice from user and as per the
choice, perform any one of following.
 Volume of Cube
 Volume of Cuboid
 Volume of Sphere
 Volume of Cylinder
35. WAP to accept an Alphabet and Display it is a Vowel or Consonant.
LOOPS
36. WAP to display all numbers from 1 to 20.
37. WAP to display all even numbers from 2 to 200.
38. WAP to display all odd numbers from 165 to 97.
39. WAP to accept a number and display sum of all even numbers and odd
numbers separately from 1 to that number.
40. WAP to accept a number and display its Factorial.
41. WAP to accept two numbers and display all numbers from first number
till last number.(first number can be greater or less than second number).
42. WAP to accept a number and display its table.
43. WAP to display following series
 1 4 7 10 13 16 19 22 25 …………………………………..200
 1 2 4 8 16 32 64 128 256 …………………………………200
 1 4 9 16 25 36 42 ………………………………………….400
 1 1 1 2 4 8 3 9 27 4 16 64 ……………………....................8000
 0 1 1 2 3 5 8 13 21 34 55 ………………………………….200
 0 1 1 2 4 7 13 24 44 ……………………………………….200
 1 2 4 7 11 16 22 29 37 46 56………………………………200
 1 2 5 10 17 26 37 50 ………………………………………200
 1 3 7 13 21 31 43 57 ………………………………………200
44. WAP to accept a number and display total digits in it.
45. WAP to accept a number and display sum of its digits.
46. WAP to accept a number and display product of digits.
47. WAP to accept a number and display Reverse number.
48. WAP to accept a number and display it is a Palindrome number or not.
49. WAP to accept a number and display it is an Armstrong number or not.
50. WAP to accept a number and display it is a Buzz number or not.
51. WAP to accept a number and display it is an Automorphic number or
not.
52. WAP to accept a number and display it is a Prime number or not.
53. WAP to accept two numbers and display their HCF.
54. WAP to accept two numbers and display their LCM.

NESTED LOOPS
55. WAP to display tables of all numbers from 5 to 17.
56. WAP to display all Palindrome numbers from 1 to 500.
57. WAP to display all Prime numbers from 1 to 200.
58. WAP to display all Armstrong numbers from 1 to 10000.
59. WAP to display factors of all numbers from 12 to 40.
60. WAP to display all Buzz numbers from 1 to 200.
61. WAP to display all Automorphic numbers from 1 to 20000.
62. WAP to generate following Patterns

* 1 1
** 22 12
*** 333 123
**** 4444 1234
***** 55555 12345
63. WAP to generate following Patterns

$ 1 1
$$ 22 12
$$$ 333 123
$$$$ 4444 1234
$$$$$ 55555 12345

64. WAP to generate following Patterns

@ 1 1
@@ 22 1 2
@@@ 333 1 2 3
@@@@ 4 4 4 4 1 2 3 4
@@@@@ 5 5 5 5 5 1 2 3 4 5
65. WAP to generate following Patterns

12345 &&&&& 5 5 5 5 5
1234 &&&& 4 4 4 4
123 &&& 3 3 3
12 && 2 2
1 & 1
66. WAP to generate following patterns

123454321 1
1234321 212
12321 32123
121 4321234
1 543212345
67. WAP to generate following pattern

1 1
12 21
123 321
1234 4321
1234554321
ARRAYS
68. WAP to accept 15 numbers in an Array and display the Largest number
and Smallest number stored in it.
69. WAP to accept 15 numbers in an Array and display largest, second
largest and third largest number stored in it.
70. WAP to accept N numbers in an array and display sum of all elements at
even positions.
71. WAP to accept N numbers in an array and add 2 to all odd numbers in
array and multiply 2 to all even numbers.
72. WAP to accept 12 numbers in an array and swap first half of Array with
its second half.
73. WAP to accept N numbers in an Array. Now accept a number and
position from user and insert that number at that position in the Array.
74. WAP to accept N numbers in an Array in ascending order. Now accept
a number and insert it in Array in such a way that even after insertion, Array
remains sorted.
75. WAP to accept 10 numbers in an array. Accept a position from user and
delete the element at that position from Array.
76. WAP to accept N numbers in an Array. Accept a number from user and
check for its existence in Array using Linear Search Technique.
77. WAP to accept N numbers in an Array. Accept a number from user and
check for the position of its existence in Array using Linear Search Technique.
78. WAP to accept N numbers in an Array. Accept a number from user and
check number of times it exists in Array using Linear Search Technique.
79. WAP to accept 15 numbers in an Array in descending order. Accept a
number from user and check for its existence using Binary Search Technique.
80. WAP to accept 12 numbers in an Array and sort them using Selection
Sort Technique.
81. WAP to accept 10 numbers in an Array and sort them using Bubble Sort
Technique.
82. WAP to accept 15 numbers in an Array and sort them using Insertion
Sort Technique.
83. WAP to accept N numbers in Array A and M numbers in Array B. Merge
elements of both arrays in Array C in such a way that first comes the element
of Array A and then of Array B.
84. WAP to accept N numbers in Array A and M numbers in Array B. Merge
elements of both arrays in Array C in such a way that first comes even elements
of Array A and Array B and then odd numbers of Array A and Array B.
85. WAP to accept N numbers in Array A and M numbers in Array B. Merge
elements of both arrays in Array C in such a way that even elements of Array
A and Array B come in Array C from left to right and odd numbers of Array
A and Array B from right to left.
86. WAP to accept N numbers in Array A in ascending order and M numbers
in Array B in descending order. Merge the elements of both arrays in Array C
using Merge Sort Technique in such a way that Array C contain all elements
in descending order.
87. WAP to accept numbers in a 2D array of N rows and M columns and
display sum of all Border elements.
88. WAP to accept numbers in a 2D array of N rows and M columns and
display sum of all left diagonal elements.
89. WAP to accept numbers in a 2D array of N rows and M columns and
display sum of all right diagonal elements.
90. WAP to accept numbers in a 2D array of N rows and M columns. Accept
a Row number from user and display sum of all elements of that row.
91. WAP to accept numbers in a 2D array of N rows and M columns. Accept
a Column number from user and display sum of all elements of that column.
92. WAP to accept numbers in a 2D array of N rows and M columns. Display
sum of all rows and columns separately.
93. WAP to accept numbers in a 2D array of N rows and M columns and
Transpose the given Array.
94. WAP to accept numbers in a 2D array of N rows and M columns and
another 2D array of M rows and T columns. Display the product of both
Matrices.
STRINGS
95. WAP to accept your first name and display it 10 times,
96. WAP to accept your full name and display it 5 times.
97. WAP to accept a String from user and display its length.
98. WAP to accept a String from user and display total Capital alphabets,
Small alphabets and digits stored in it.
99. WAP to accept a String and display total words in it.
100. WAP to accept your full name and display its initials only.
101. WAP to accept a String and convert it to Title Case.
102. WAP to accept a String and convert it to toggle case.
103. WAP to accept first name, middle name and last name separately.
Combine the three names to create full name.
104. WAP to accept two strings. Add second string after first string.
105. WAP to accept a string and reverse it.
106. WAP to accept a string and check it is a Palindrome or not.
107. WAP to accept a String and display each word in reverse.
For eg if String is “Ram is a good Boy”
Then output should be maR si a doog yoB
108. WAP to accept a String and diplay words in reverse order.
For eg if String is “Ram is a good Boy”
Then output should be Boy good a is Ram
FUNCTIONS
109. WAP to accept 3 numbers and display their Average using UDF which
accept three numbers as Parameter and return their sum.
110. WAP to accept two numbers and swap their values using UDF which
accept two numbers as parameters and swap their values,
111. WAP to accept two numbers and display all numbers from first number
to second number using UDF that accepts the two numbers as parameter.
112. WAP to accept a number and display it is Palindrome or not using UDF
that accepts a number and returns the reverse number.
113. WAP to accept a number and display it is Armstrong number or not using
UDF that accepts a number as parameter and return 1 if no is Armstrong else
return 0.
114. WAP to accept a number from user and display it is a Prime number or
not using UDF that accepts number as parameter and returns alphabet ‘Y’ if
number is Prime else returns alphabet ‘N’.
115. WAP to accept a number from user and display its table using UDF that
accept the number as Parameter and display its Table.
116. Define a function that accepts a character and a number as parameter and
display that character, that number of times. Define the function in such a way
that if number is not passed then the character is displayed 12 times and if
character and number both are not specified then ‘*’ is displayed 12 times.
117. WAP to overload function Area( ) to calculate area of square, Rectangle,
Circle or Triangle.
118. WAP using Recursive functions to display the following series
i) 2 4 6 8 10 12 14 ……………………….100
ii) 1 2 4 7 11 16 22 ……………………….100
iii) 0 1 1 2 3 5 8 13 ………………………..100
iv) 99 97 95 93 91 89 ……………………..1
119. WAP using a Recursive function that accepts a number and returns its
Factorial.
STRUCTURE
120. WAP to accept name, age and salary of 2 Persons using Structure.
121. WAP to accept Roll no, name, class, section and percentage of 15
Students using Structure.
122. WAP to accept first name, mid name, last name, area, exchange and
number of phone of a person using nested structure.
123. A structure Time contain 3 integer elements for Hour, Minute and
Second.
A UDF SUMTIME( ) accepts 2 objects of structure Time as Parameter and
return the sum of both Times.
WAP to accepts 2 sets of times and display total time in Hour, Minute and
Second.
124. WAP to accept name, department, post and salary of 15 Employees and
sort them on department using Selection Sort technique.
125. WAP to accept name, department, post and salary of 15 Employees and
sort them on salary in descending order using Insertion Sort technique.

You might also like