Practical programs with flowchart
Practical programs with flowchart
1) Write a python program to interchange the values of two variables using the
third variable.
Flowchart:
Program:
print("Before interchanging")
print("value of a =", a)
print("value of b =", b)
temp=a
a=b
b=temp
print("After interchanging")
print("value of a =", a)
print("value of b =", b)
2) Write a python program to input two numbers and perform all arithmetic
operations on them.
Flowchart:
Program:
s=a+b
d=a-b
p=a*b
q1=a/b
q2=a//b
r=a%b
print("Addition =",s)
print("Subtraction=",d)
print("Multiplication=",p)
print("Remainder =", r)
3) Write a python program to input length and width of a rectangle and find its
area and perimeter.
Flowchart:
Program:
area=l*w
perimeter=2*(l+w)
Flowchart:
Program:
Flowchart:
Program:
PROGRAM:
num=int(input("Enter number:"))
temp=num
rev=0
while(num>0):
dig=num%10
rev=rev*10+dig
num=num//10
if(temp==rev):
print("The number is a palindrome!")
else:
print("The number isn't a palindrome!")
12. Write a program to print the following patterns:
12345
1234
123
12
1
rows = 5
for i in range(rows,0,-1):
for j in range(1, i + 1):
print(j,end=" ")
print('\r')
*****************