Program 1: Lab Task #5
Program 1: Lab Task #5
Program 1
Practicing with simple while loop, giving them the final condition of loop.
INPUT:
OUTPUT:
Program 2
Practicing with simple while loop with infinite iterations as the condition is always
true.
INPUT:
OUTPUT:
Program 3
Write a program which takes the limit for while loop condition and sum the total
amount
INPUT:
OUTPUT:
Program 4
Practicing with simple while loop with else condition.
INPUT:
OUTPUT:
Program 5
Write a function f which takes one argument x, it will square the value of x
and add 1 in it then return the answer to user.
INPUT:
OUTPUT:
Program 6
INPUT:
OUTPUT:
Program 7
INPUT:
OUTPUT:
PROGRAMMING EXERCISES:
Q1 Write down a Python program, using While loop that generates Odd no’s in
between 1 to 100.
INPUT:
OUTPUT:
Q.2 Write down a Python Program using While loop to generate the following output.
1. **************
**************
**************
**************
**************
**************
**************
**************
INPUT:
OUTPUT:
2. *
**
***
****
*****
******
*******
********
INPUT:
OUTPUT:
3. ********
*******
*****
****
***
**
*
INPUT:
OUTPUT:
Q.3 Write down a python program having one function for calculating factorial of a no.
And call that function within a While loop to generate factorial of numbers from 0 to 10
INPUT:
OUTPUT: