C++ Flow Control Assignment I

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

C++ Flow Control Assignment I

1. Check if a number is odd or even


2. Check if a year is leap year or not
3. Given the coefficients a, b and c, print all the roots of the quadratic equation
ax^2+bx+c = 0
4. Check whether a character entered is a vowel or not
5. Find the minimum and maximum of two numbers, three numbers.

6. Find the sum of first n natural numbers.


7. Find n!
8. Given a data type, which uses ‘b’ bytes, find the signed and unsigned value
ranges of the data type.
9. Check whether n is prime or not.
10. Check whether n is a perfect number or not.
11. Print Fibonacci series
12. Find GCD of two numbers
13. Find LCM of two numbers
14. Find the sum of digits of a number.
15. Reverse the number.
16. Check whether the number is a palindrome or not.
17. Convert a number from decimal to binary
18. Check whether a number is armstrong or not.
19. Print pattern :- 1, 3, 5, 7, … (n terms)
20. Print pattern :- 1, 3, 5, 7, ….(till last term <= n)
21. Find all prime numbers between l to r.
22. Find all perfect numbers between l to r.

- Try to do as many of them as possible before the next session (i.e. 29-05-21).
- It's ok to discuss the problems in the whatsapp group.
- It's not ok to just google the problems.
- We will try to discuss some of these problems during the session. But it’s impossible to
discuss all of them. So try to discuss less interesting problems amongst yourselves.
- This is one of the most important topics in building the fundamentals. So give maximum
effort.

You might also like