You are on page 1of 2

Tentative 5 marks questions for exam(covering upto loops):

1. Swap two numbers

a. By using a third variable.

b. Without using a third variable.

2. Print first ‘n’ terms of the fibonacci series 0, 1, 1, 2, 3 …. . enter the value of ‘n’ from the user.

3. Take a value from the user in centimetres and output the value in feets and inches. Example: 132
cms should be outputted as 4ft and 2.96 inches.

4. Enter three numbers from the user and print if a triangle is possible with those three numbers as
three sides of a triangle. Example: if input is 4, 3, 5, then a triangle is possible. If input is 1, 1, 3,
then a triangle is not possible.

5. Print the maximum and minimum from a ten numbers the user inputs.

6. Input a year and print if it is a leap year or not.

7. Enter a number and print if it is a pallindrome number or not. Example: 1221,131,454 are all
pallindrome numbers, the number = the reverse of the number.

8. Enter a number and print if it is a perfect number or not. A perfect number is a number which is
equal to the sum of the factors of that number. Example: 6 is a perfect number (6= 1+2+3).

9. Enter a number and print if it is an armstrong number or not. Armstrong number = sum of the
cubes of the digits of the number. Example : 153 = 1*1*1 + 5*5*5 + 3*3*3.

10. Enter a number and print all the perfect squares that are less than that number.

11. Enter a number ‘n’. and then print the sum of the series of 1*1 – 2*2 + 3*3 – 4*4 … upto n
terms.

12. Enter any number, output the floor and ceiling value of that number.

13. Enter any number and print its table. Example: if 3 is entered then output should be the three
table.

14. Enter a character. If the character is in lower case then convert it into uppercase or vice-versa.

15. Find the second highest of ten numbers inputted by the user.

16. Print the sum of first 100 odd numbers and first hundred even numbers using one single loop.

17. Input any number between 1-7 and print the corresponding day of the week. Example: if 1 is
inputted then output should be Monday, if 3 is the input then output is Wednesday.

18. Enter three sides of a triangle and print whether it is an equilateral triangle or isosceles triangle
or scalene triangle.
19. Enter a number and print all the prime numbers less than that number.

20. Enter a number and print if it is a prime number or not.

21. Ask the user to enter the number of units comsumed and print the amount of the electricity bill
using the following rules:

Number of units Rupees per unit

0-100th 0.5

101-200th 0.75

201th and more 1

Example: if the user enters 256 units then the output will be (256-200)*1 + (200-100)*0.75 + (100-0)*0.5
=181 rupees.

You might also like