SourceCodes

# WAP to print the statement "hello world"
print ("hello world...!")

# WAP to print your name as a statement
a = "My name is Chandrakanta Sen"
print (a)

a = ("My office name is IIHT")
print (a)

# WAP to print the sum of two numbers
a = 10.3576
b = 20
c = (a + b)
print (c)

# WAP to take the input from the user
age = input("What is your age? ")
print ("Your age is: ", age)

# WAP to find the average between three nos.
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
c = int(input("Enter the third number: "))

avg = int((a + b + c) / 3)

print ("The average of three numbers are: ", avg)

# WAP to convert Centigrade - Fahrenheit
cen = int(input("Enter the centigrade value: "))

far = int(((9*cen)/5)+32) 
print ("Required the Fahrenheit value: ", far)

# WAP to find the Power of a number
num = int(input("Enter the number: "))

powNum = pow(num,2)
print("Power of the number: ", powNum)

# WAP to find the Sum of Digits of a 3-digit no. (without loop)
num = int(input("Enter the number: "))

d1 = (num % 10)
d2 = (num / 10) % 10
d3 = (num / 100)

sum = int(d1 + d2 + d3)
print("Sum of digit: ",sum)

# WAP to find the Reverse of Digits of a 3-digit no. (without loop)

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

d1 = (num % 10)
d2 = (num / 10) % 10
d3 = (num / 100)

rev = int(int(d1) * 100 + int(d2) * 10 + int(d3) * 1)
print("Sum of digit: ",rev)
Maintained by Chandrakanta Sen . Powered by Blogger.