1.
Program to add two Number
Input :-
# in this program the user can input by own
a=int(input("enter the first number :-"))
b=int(input("enter the second number:-"))
#the sum function
c=a+b
print("the sum of desired number is :-",c)
output:-
[Link] to find the Simple Interest
INPUT:-
P = float(input("Enter the principal amount:- "))
R = float(input("Enter the rate of interest:- "))
T = float(input("Enter the time in years:- "))
# formula of simple interest
SI = (P * R * T) / 100
print("Simple Interest =", SI)
output:-
[Link] to find factorial of a
number
Input:-
n = int(input("Enter a number: "))
factorial = 1
#here we use range to make factorial
for i in range(1, n + 1):
factorial *= i
print("Factorial of", n, "is", factorial)
output:-
[Link] to find length of a word
Input:-
#to find of a number we use len
a=(input(" enter the name:-"))
print("the length in a is ",len(a))
Output:-
[Link] to print Table
Input:-
num = int(input("Enter a number: "))
print("Multiplication Table of", num)
for i in range(1, 11):
print(num, "x", i, "=", num * i)
output:-
[Link] to find number is odd or
even
Input:-
n = int(input("Enter a number: "))
if n % 2 == 0:
print("Even number")
else:
print("Odd number")
output:-
[Link] to find number is Positive
or Negative
Input:-
n = int(input("Enter a number: "))
if n > 0:
print("Positive")
elif n < 0:
print("Negative")
else:
print("Zero")
output:-
[Link] to find the square of a
number
Input:-
n = int(input("Enter number: "))
print("Square =", n * n)
output:-
[Link] to check prime number
Input:-
num = int(input("Enter a number: "))
if num > 1:
for i in range(2, num):
if num % i == 0:
print("Not Prime")
break
else:
print("Prime Number")
else:
print("Not Prime")
output:-
[Link] to convert Celsius to
Fahrenheit
Input:-
c = float(input("Enter temperature in Celsius: "))
f = (c * 9/5) + 32
print("Fahrenheit =", f)
output:-