These are the assignment for all the student who wants to check his/her strength in looping and in branching statement. Just try to solve and enjoy.
Q1. Write a program in C++ to print the following pattern on the monitor
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Q2. Write a program in C++ to print the following pattern on the monitor
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Q3. Write a program in c++ to print the following pattern on the monitor
1
1 0
1 0 1
1 0 1 0
1 0 1 0 1
Q5. Write a program in c++ to print the following pattern on the monitor
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
Q6. Write a program in c++ to print the following pattern on the monitor
1
1 2 2 2
1 3 2 3 3 3
Q7. Write a program in c++ to print the following pattern on the monitor
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Q8. Write a program in C++ to print the following pattern on the monitor
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
Q9 Write a program in C++ to print the following pattern on the monitor
1
2 3 4
5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25
Q10. Write a program in C++ to print the following pattern on the monitor
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Q11 Write a program in C++ to print the following pattern on the monitor
*
* *
* * *
* * * *
* * * * *
Q12. Write a program in C++ to print the following pattern on the monitor
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
Q13. Write a program in C++ to print the following pattern on the monitor
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Q14. Write a program in C++ to print the following pattern on the monitor
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1
Q15. Write a program in C++ to print the following pattern on the monitor
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 5 4 3 2 1
1 2 3 4 4 3 3 1
1 2 3 3 2 1
1 2 2 1
1 1
Q15. Write a program in C++ to print the following pattern on the monitor
A B C D E F E D C B A
A B C D E E D C B A
A B C D D C B A
A B C C B A
A B B A
A A
Q16. Write a function to read three numbers from the keyboard and find out the largest from them?
Q17. Write a function to read three numbers from the keyboard and arrange them in ascending order (do not sort them )
Q18. Write a program in C++ to read 10 integer numbers from the keyboard and find out the sum and average of all the entered numbers
Q.19 Write a program in C++ to read 10 numbers from the keyboard and find out the largest number from them?
Q20. Write a program in C++ to read 10 numbers from the keyboard and find out the largest and lowest numbers from them
Q21. Write a program in C++ to read 10 numbers from the keyboard and find out the largest and second largest number from them.
Q22. Write a program in C++ to read an integer number and find out the sum of it’s digits?
Q23. Write a program in C++ to read an integer number and find out the reverse of the digits?
Example Number = 1234 result is = 4321
Q24. Write a program in C++ to read a number and check if the entered number is Armstrong or not ?
Q25. Write a program in C++ to find out all the Armstrong numbers between 1 and 1000.
Q26 Write a program in C++ to read a number and check if it is palindrome or not.
Q27. Write a program in C++ to find out all the palindrome number between 100 and 500.
Q28. Write a program in C++ to read a binary number and convert this number in to its equivalent decimal number
Q29. Write a program in C++ to read a number and check if it is auto morphic or not . if it is automorphic
display a proper message on the sceen.( A number when multiplied by it self , the resultant number contains the last digits of the original number )
Example ( 5 )2 = 2 5
( 6) 2 = 36
(25 )2 = 625
Q30 Write a program in C++ to read a number and check if it is prime or not ?
Q31 Write a program in C++ find out all the prime number between 100 and 200
Q32 Write a program in C++ to read a number and find out all the odd prime factor of a given number?
Q33 Write a program in C++ to read a number from the keyboard and find out the factorial of this given integer Number
Q34. Write a program in C++ to read two numbers from the keyboard and find out the largest from them?
Q35 Write a program in C++ to read three numbers and find out the largest among them?
Q36 Write a program in C++ to read the total marks obtained by a student in a subject . Find out the Grade of the student in that subject. The criteria for calculating grades is as follows
Marks obtained Grade
>= 90 A1
< 90 and >=80 A2
<80 AND >=70 B1
< 70 AND > = 60 B2
< 60 C1
Q37. Write a program in C++ to read the total number of electricity unit consumed by the consumer . The tariff plan for the bill is as follows
Unit Rate/Unit(Rs.)
<=100 1.00
> 100 and < = 200 2.50
>200 and < = 400 3.00
> 400 4.10
calculate the total bill, consumer have to pay?
Q38. Write a program in C++ to read a number from the keyboard and display the corresponding day of the week.
Example : If user enters 2 . Computers print : Tuesday
If user enters 7 . Computers print : Sunday
Q39. Write a program to read a year and check if it is Leap year or not ?
Q40. Write a program to read a number from the keyboard and find out the factorial of the given number?
Q41 Write a program in C++ to read two numbers X and Y and find out XY. ( Do not use built in library
function)
Q42 Write a program in C++ to print the following series on the monitor
1,2,3,4,5,6,7,…………………………………………………………………10000
Q43 Write a program in C++ to print the following series on the monitor
2,4,6,,8,10……………………………………………………………………10000
Q44. Write a program in C++ to print the following series on the monitor
1,3,5,7,9………………………………………………………………………999
Q45 Write a program in C++ to print the following series on the monitor
1,5,9,13……………………………………………………………………….999
Q46 Write a program in C++ to print the following series on the monitor
1,4,9,16……………………………………………………………………….100
Q47. Write a program in C++ to print the following series on the monitor
1,8,27,64……………………………………………………………………..1000
Q49. Write a program in C++ to print every integer between 1 and N divisible by M. Also report whether that
number is even or odd.
Q50. Write a program in C++ to find the sum of the following series
S = 1+x+x2+x3+x4+……………………………….xn
No comments:
Post a Comment