**Loops**

**1)Print the even numbers between 0 and 50 (use while)**

2)Print the odd numbers between 0 and 50 in the reverse order ( use while)

3)Print the series 5,10,15,….,100 (using for loop)

4)Generate the series 1, 2, 4 ,7, 11 ,16....n ( use while...read n)

5)Generate the Fibonacci series 0 1 1 2 3 5 8…..n ( use do while..read n)

6)Find the factorial of a number ( use for statement do not use built in factorial() function)

7)Print the powers of a number upto 10th power. ( Eg: if n=2 then the program should print 2^0, 2^1, 2^2,2^3,…..,2^10 use for loop)

8)Print the multiplication table of a given number. ( use while)

9)Print the numbers from 1 to 10 and their natural logarithms as a table ( use for)

10)Find the sum of the digits of a number.( use while-university question)

11)Check whether the given 3 digit number is an Armstrong number. (use do while Eg:153,370,371,407)

12)Find the factors of a number ( use for)

13)Check whether the given number is prime or not ( use for)

14) Find the GCD or HCF of two numbers ( use Euclid algorithm and while loop)

15) Reverse a number (use while)

16)Find the numbers between 10 and 1000 that are divisible by 13 but not divisible by 3

( use for)

17)Find the sum of series 1-x^2/2+x^4/4-x^6/6........x^n/n ( use while)

18)Check whether the given number is a Krishnamurti number( Krishnamurthy Number: It is a number which is equal to the sum of the factorials of all its digits.

For example : 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145)

19)Read N numbers and find the biggest and smallest. ( university question)

20)Read N numbers and find the sum of all odd and even numbers separately.(university question)

21)Count the number of digits in a number.(university question)

22)Write a Python program to input a list of n numbers. Calculate and display the

sum of cubes of each value in the list.(university question)

23)Write a python program to count the number of zeros and negative terms in a given set of n numbers.

24)Write a python program to input a list of n numbers. calculate and display the average of numbers. Also display the cube of each value in the list.( university question)

25)read mark of n students and print the average mark.Also print the number of students who scored more than 80% mark (mark out of 50)

**programs using nested loops**

Generate the following pattern

1)

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

2)

1 2

1 2 3

1 2 3 4

1 2 3 4 5

2)

* * * * *

* * * *

* * *

* *

*

3)

* * * *

* * *

* *

*

3)

1

2 3

4 5 6

7 8 9 10

4)Print the multiplication table of numbers from 5-15.

5)Print all prime numbers in a given range.

6)Print all 3 digit Armstrong numbers in a range.

7)Print all the factors of numbers between 10 and 20.

8)Print all Armstrong numbers in the given range.

9)Print all Krishnamurti numbers in the given range.

10)Print the sum of digits of all numbers between 100 and 200.

2 3

4 5 6

7 8 9 10

4)Print the multiplication table of numbers from 5-15.

5)Print all prime numbers in a given range.

6)Print all 3 digit Armstrong numbers in a range.

7)Print all the factors of numbers between 10 and 20.

8)Print all Armstrong numbers in the given range.

9)Print all Krishnamurti numbers in the given range.

10)Print the sum of digits of all numbers between 100 and 200.

## Comments

## Post a Comment