0% found this document useful (0 votes)
3 views6 pages

Python Programs for Basic Operations

Uploaded by

vishukum016
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)
3 views6 pages

Python Programs for Basic Operations

Uploaded by

vishukum016
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

EXPERIMENT NO.

:-01

Name:- Shaikh MahammadJaid Yasin

STD.:-BCA-III

Div.:-C

Roll No.:- 53

Date:-

Title :- Writer python programme to do arithmetic operations such as addition


subtraction multiplication and division.

CODE :-

a = float(input("Enter first number: "))

b = float(input("Enter second number: "))

print("Addition:", a + b)

print("Subtraction:", a - b)

print("Multiplication:", a * b)

print("Division:", a / b)

OUTPUT :-
EXPERIMENT NO.:-02

Name:- Shaikh MahammadJaid Yasin

STD.:-BCA-III

Div.:-C

Roll No.:- 53

Date:-

Title :- Write python programme to display greatest among three number.


CODE :-

num1 = float(input("Enter first number: "))

num2 = float(input("Enter second number: "))

num3 = float(input("Enter third number: "))

if num1 >= num2 and num1 >= num3:

greatest = num1

elif num2 >= num1 and num2 >= num3:

greatest = num2

else:

greatest = num3

print("The greatest number is:", greatest)

OUTPUT :-
EXPERIMENT NO.:-03

Name:- Shaikh MahammadJaid Yasin

STD.:-BCA-III

Div.:-C

Roll No.:- 53

Date:-

Title :- Write Python programme to display multiplication table of any number.

CODE :-

num = int(input("Enter a number to display its multiplication table: "))

print(f"\nMultiplication table of {num}:\n")

for i in range(1, 11):

print(f"{num} x {i} = {num * i}")

OUTPUT :-
EXPERIMENT NO.:-04

Name:- Shaikh MahammadJaid Yasin

STD.:-BCA-III

Div.:-C

Roll No.:- 53

Date:-

Title :- Write Python programme to find factorial of given number.

CODE :-

num = int(input("Enter a non-negative integer: "))

if num < 0:

print("Factorial is not defined for negative numbers.")

else:

factorial = 1

for i in range(1, num + 1):

factorial *= i

print(f"The factorial of {num} is: {factorial}")


OUTPUT :-
EXPERIMENT NO.:-05

Name:- Shaikh MahammadJaid Yasin

STD.:-BCA-III

Div.:-C

Roll No.:- 53

Date:-

Title :- Write Python programme to reverse the given number using while loop.

CODE :-

num = int(input("Enter a number: "))

original_num = num

reversed_num = 0

while num > 0:

digit = num % 10

reversed_num = reversed_num * 10 + digit

num = num // 10

print("Reversed number:", reversed_num)

OUTPUT :-

You might also like