BASIC INPUT OUTPUT PROGRAMS
#
Program 1
'''Program to Print a
Hello World…'''
print('Hello
World...')
############################################################################
#Program 2
'''Program to Enter & Print a String '''
n
= input('Enter Your Name ')
print('Welcome'
, n)
############################################################################
#Program 3
'''Program to Perform Arithmetic Operations'''
n1
= int(input('Enter First Number '))
n2
= int(input('Enter Second Number '))
total
= n1 + n2
sub
= n1 - n2
prod
= n1 * n2
div
= n1 / n2
print('Total
=',total)
print('Subtract
=',sub)
print('Product
=',prod)
print('Divide
=',div)
############################################################################
#Program 4
'''Program to find Area of Rectangle'''
l = int(input('Enter Length '))
b = int(input('Enter Breadth '))
area = l * b
print('Area of Rectangle =',area)
############################################################################
#Program 5
'''Program to find the area of Circle'''
import math
radius = int(input('Enter Radius '))
area = math.pi * radius**2
print('Area of Circle =',area)
############################################################################
#Program 6
'''Program to Convert fahrenheit into
celcius'''
F
= float(input("Enter temperatute(in fahrenheit)"))
C
= (F-32)* 5/9
print("In
Celcius = ",C)
############################################################################
#Program 7
'''Program to Swap two Numbers'''
A = int(input('Enter value of (A)
'))
B = int(input('Enter value of (B)
'))
print('You have entered A =',A,'B
=',B)
#Swapping
A,B = B,A
print('After swap A =',A,'B =',B)
############################################################################
# Program 8
'''Program to reverse 3 digit number'''
num = int(input("Enter 3 digit
number :"))
x = num%10
print(x,end='')
num=num//10
x=num%10
print(x,end='')
num=num//10
x=num%10
print(x,end='')
#Later on we can use while loop to
reverse any number
############################################################################
No comments:
Post a Comment