Content
1. Hello World Program
print("HELLO WORLD!")
output:
HELLO WORLD!
2. Print integer example
a=int(input("Enter An integre number:"))
print("you enter:",a)
output:-
>>>
Enter An integre number:10
you enter: 10
>>>
3. Addition of two number
a=10
b=20
c=a+b
print("addition:",c)
Output:-
>>>
addition: 30
>>>
4. Addition, substraction, multiplication,division and modulus.
a=15
b=6
print("add:",a+b)
print("div:",a-b)
print("mul:",a*b)
print("modulus:",a%b)
Output:-
>>>
add: 21
sub: 9
mul: 90
div: 2.5
modulus: 3
>>>
5. User input and then add, sub, mul,div,modulus.
a=int(input("enter first integer value:"))
b=int(input("enter second integer value:"))
print("\nadd:",a+b)
print("sub:",a-b)
print("mul:",a*b)
print("div:",a/b)
print("modulus:",a%b)
Output:-
>>>
enter first integer value:25
enter second integer value:12
add: 37
sub: 13
mul: 300
div: 2.0833333333333335
modulus: 1
>>>
6. Find square of anumber
a=int(input("enter any integer number:"))
b=a*a
print("\nsquare:",b)
Output:-
>>>
enter any integer number:4
square: 16
>>>
7. Find area of circle.
r=int(input("enter radius of circle:"))
area=3.14*r*r
print("\narea:",area)
Output:-
>>>
enter radius of circle:6
area: 113.03999999999999
>>>
8. Find valume of cube.
a=int(input("enter one side of cube:"))
cube=a*a*a
print("\ncube:",cube)
Output:-
>>>
enter one side of cube:3
cube: 27
>>>

0 Comments