04 Loop
04 Loop
Difficulty
SL Problem statement
levels
1. Write a program (WAP) that will print following series upto Nth terms. *
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, …….
2. Write a program (WAP) that will print following series upto N th terms. *
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 …….
3. Write a program (WAP) that will print following series upto N th terms. **
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, …….
4. Write a program (WAP) that will take N numbers as inputs and compute their average. *
(Restriction: Without using any array)
7. Write a program (WAP) that will run and show keyboard inputs until the user types an ’A’ *
at the keyboard.
Sample input Sample output
X Input 1: X
1 Input 2: 1
a Input 3: a
A
8. Write a program (WAP) that will reverse the digits of an input integer. **
9. Write a program (WAP) that will find the grade of N students. For each student, it will *
take the marks of his/her the attendance (on 5 marks), assignment (on 10 marks), class
test (on 15 marks), midterm (on 50 marks), term final (on 100 marks). Then based on the
tables shown below, the program will output his grade.
Attendance (A) 5%
Assignments (HW) 10%
Class Tests (CT) 15%
Midterm (MT) 30%
Final (TF) 40%
10. Write a program (WAP) that will give the sum of first Nth terms for the following series. **
1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, …….
12. Write a program (WAP) that will print Fibonacci series upto Nth terms. **
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …….
13. Write a program (WAP) that will print the factorial (N!) of a given number N. Please see **
the sample input output.
14. Write a program (WAP) that will find nCr where n >= r; n and r are integers. **
16. WAP that will find the GCD (greatest common divisor) and LCM (least common multiple) **
of two positive integers.
18. WAP that will determine whether an integer is palindrome number or not. **
20. Write a program that takes an integer number n as input and find out the sum of the **
following series up to n terms.
1 + 12 + 123 + 1234 + …….