Looping Statement Test 5

  

Looping Statement Test 5

Q1. Write program to print the following pattern.

a.     1

1 2

1 2 3

1 2 3 4

 

b.     * * * *

* * *

* *

*

Q2. Accept 10 numbers from the user and display

    their average.

Q3. Write a program to print all prime numbers 

    that fall between two numbers(accept two 

    numbers from the user)

Q4. Write a program to display sum of odd numbers

    and even numbers that fall between 12 and 37

    (including both numbers)

Q5. Write a program to display all the numbers 

    which are divisible by 11 but not by 2 between

    100 and 500.

Q6. How many times the following loop execute?

c = 0

while c < 20:

           c += 2

Q7. Write the output of the following.

c = -9

while c < 20:

               c += 3

               print(c)

 

Q8. Write a program to print first 20 natural

    numbers except multiple of 2 & 3.

 

Q9. Write a program to print table of a number

    (accepted from user) in the following format.

    Like : input number is 7, so expected output  

    is

    7 * 1 = 7

    7 * 2 = 14 and so on

 

Q10. Write a program that keep on accepting number

     from the user until user enters Zero. 

     Display the sum and average of all the 

     numbers.

 

 

No comments:

Post a Comment

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet