0% found this document useful (0 votes)
22 views2 pages

Lab 3

Notes module 1

Uploaded by

lisaandrias5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Lab 3

Notes module 1

Uploaded by

lisaandrias5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program to determine the largest of n numbers.

n=int(input("Enter limit"))
num=int(input("Enter a number"))
l=num
for i in range(n):
num=int(input("Enter a number"))
if num>l:
l=num
print(l)

Program to determine the average age of students in a class. The user will stop
giving the input by giving the age as 0

age=int(input("Enter Age"))
count=0
sum=0
while(age!=0):
count=count+1
sum=sum+age
age=int(input("Enter Age"))
avg=sum/count
print("Average age is: ",avg)
Program to find the factorial of a number.
n=int(input("Enter a number"))
f=1
for i in range(1,n+1):
f=f*i
print("factorial is: ",f)

You might also like