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

Viii Practice Programs

The document contains five programs demonstrating basic programming concepts. Program 1 displays names of three flowers, Program 2 adds three numbers, Program 3 calculates the difference between two user-input numbers, Program 4 performs basic arithmetic operations on user inputs, and Program 5 calculates the perimeter of a rectangle based on user-provided dimensions. Each program includes input prompts and outputs the results accordingly.

Uploaded by

Tanmay Panda
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)
0 views2 pages

Viii Practice Programs

The document contains five programs demonstrating basic programming concepts. Program 1 displays names of three flowers, Program 2 adds three numbers, Program 3 calculates the difference between two user-input numbers, Program 4 performs basic arithmetic operations on user inputs, and Program 5 calculates the perimeter of a rectangle based on user-provided dimensions. Each program includes input prompts and outputs the results accordingly.

Uploaded by

Tanmay Panda
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
You are on page 1/ 2

PROGRAM-1:

#PROGRAM-1
#WRITE A PROGRAM TO DISPLAY NAMES OF THREE FLOWERS.
print("MY FAVORITE FLOWER-1 IS: ROSE")
print("MY FAVORITE FLOWER-2 IS: LOTUS")
print("MY FAVORITE FLOWER-3 IS: LILY")
print("FINISH")
OUTPUT:
MY FAVORITE FLOWER-1 IS: ROSE
MY FAVORITE FLOWER-2 IS: LOTUS
MY FAVORITE FLOWER-3 IS: LILY
FINISH

PROGRAM-2:
#PROGRAM-2
#WRITE A PROGRAM TO ADD THREE NUMBERS.
A=12
B=13
C=14
sum=A+B+C
print("SUM OF A, B, C IS: ", sum)
print("FINISH")
OUTPUT
SUM OF A, B, C IS: 39
FINISH

PROGRAM-3
#PROGRAM-3
#WRITE A PROGRAM TO TAKE INPUT FROM USER AND SHOW "DIFFERENCE" OPERATION.
A=int(input("ENTER YOUR FIRST NUMBER: "))
B=int(input("ENTER YOUR SECOND NUMBER: "))
DIFF=A-B
print("DIFFERENCE OF A, B IS: ", DIFF)
print("FINISH")
OUTPUT
ENTER YOUR FIRST NUMBER: 10
ENTER YOUR SECOND NUMBER: 5
DIFFERENCE OF A, B IS: 5
FINISH

PROGRAM-4
#PROGRAM-4
#WRITE A PROGRAM TO TAKE INPUT FROM USER AND DO BASIC CALCULATION.
A=int(input("ENTER YOUR FIRST NUMBER: "))
B=int(input("ENTER YOUR SECOND NUMBER: "))
S=A+B
D=A-B
M=A*B
D=A/B
print("SUM OF A, B IS: ", S)
print("DIFFERENCE OF A, B IS: ", D)
print("MULTIPLICATION OF A, B IS: ", M)
print("DIVISION OF A, B IS: ", D)
print("FINISH")
OUTPUT:
ENTER YOUR FIRST NUMBER: 15
ENTER YOUR SECOND NUMBER: 5
SUM OF A, B IS: 20
DIFFERENCE OF A, B IS: 10
MULTIPLICATION OF A, B IS: 75
DIVISION OF A, B IS: 3.0
FINISH

PROGRAM-5:
#PROGRAM-5: FIND PERIMETER OF RECTANGLE
l=float(input("ENTER LENGTH OF RECTANGLE IN CM. IS: "))
b=float(input("ENTER BREADTH OF RECTANGLE IN CM. IS: "))
P=2*(l+b)
print("PERIMETER OF RECTANGLE IN CM IS: ", P)
print("FINISH")

OUTPUT
ENTER LENGTH OF RECTANGLE IN CM. IS: 5.5
ENTER BREADTH OF RECTANGLE IN CM. IS: 2.5
PERIMETER OF RECTANGLE IN CM IS: 16.0
FINISH

You might also like