Professional Documents
Culture Documents
"Enter The Number Which You Print Table:" " " " "
"Enter The Number Which You Print Table:" " " " "
"Enter The Number Which You Print Table:" " " " "
PRATICAL-4
Programs to implement Control Statements(if, if-else, nested if-else, for loop, while loop, break
statement, continue statement):
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe
C:/Users/a/Desktop/18bcs4328/program1.py
6*1=6
6 * 2 = 12
6 * 3 = 18
6 * 4 = 24
6 * 5 = 30
6 * 6 = 36
6 * 7 = 42
6 * 8 = 48
6 * 9 = 54
6 * 10 = 60
2. Find sum of Natural numbers from 1 to 10. Add digits of a number using while loop.
sum = 0
for x in range(1,11):
sum =sum+x
print("sum of natural number 1 to 10 :",sum)
d=0
while sum>0:
r=sum%10
d=sum+r
sum=int(sum/10)
print("sum",d)
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe C:/Users/a/Desktop/18bcs4328/program1.py
sum of natural number 1 to 10 : 55
sum 10
PRATICAL-5
Write a program to Calculate area of the circles using followings Types of the functions
1.Simple Function
def circle():
r=int(input("enter radius of circle:"))
area=3.14*r*r
print(" area of circle :",area)
circle()
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe
C:/Users/a/Desktop/18bcs4328/program1.py
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe
C:/Users/a/Desktop/18bcs4328/program1.py
area of circle : 200.96
3. Functions with return type
def circle():
r=int(input("enter the radius:"))
area=3.14*r*r
return area
f=circle()
print("the area is:",f)
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe
C:/Users/a/Desktop/18bcs4328/program1.py
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe
C:/Users/a/Desktop/18bcs4328/program1.py
the area is: 452.15999999999997
PRATICAL-6
Write a program to calculate factorial of 10 numbers using return type with
function. Using Single functions Only
def factorial(a):
for x in range(1,a):
a = a*x
return a
for x in range (1,11):
number=int(input("enter the no:"))
print(factorial(number))
C:\Users\a\Desktop\18bcs4328\venv\Scripts\python.exe
C:/Users/a/Desktop/18bcs4328/program1.py
120
24
40320
362880