python record
python record
Ex.No.1
USE OF CONTROL STATEMENTS Reg. No :URK24CS1033
16.12.24
1a. Write a python program to find the factorial of a number using while loop.
Aim:
To write a python program to find the factorial of a number using while loop.
Description/Algorithm:
Program:
n=int(input(“enter a number:”))
factorial=1
while n>0:
factorial *=n
n=n-1
print(“factorial of a number is:”, factorial)
Output: (Screenshots)
1
23CS1008 Python Programming Lab
2
23CS1008 Python Programming Lab
Aim:
The aim of the program is to write a python program to print alphabet pattern ‘E’.
Algorithm:
Program:
print(“*****”)
print(“*”)
print(“*”)
print(“****”)
print(“*”)
print(“*”)
print(“*****’)
Output: (Screenshots)
1e. Write a python program to check whether the number is palindrome or not.
Aim:
The aim of the program is to check whether the number is palindrome or not .
Algorithm:
Program:
number=input(“enter a number:”)
if number ==number[::-1]:
print(“The given number is palindrome”)
else:
print(“The given number is not palindrome”)
Output: (Screenshots)
4
23CS1008 Python Programming Lab