SSITSMentor - CS IP Tasks
Our objective is to expertise students for career success.We trained students for different computer courses.
3) swap two numbers (using third variable)
=>
x = int( input("Please enter value for x: "))
y = int( input("Please enter value for y: "))
temp_1 = x
x = y
y = temp_1
print ("The Value of x after swapping: ", x)
print ("The Value of y after swapping: ", y)
----------------------------------------------------------
4) to Check if a Number is Odd or Even
(use of % operator)
=>
num = int(input("Enter a number: "))
if (num % 2) == 0:
print("given is Even number".format(num))
else:
print("given is Odd number".format(num))
---------------------------------------------------------------
1) Write a python program to calculate and print their sum, product and difference of 2 numbers ?
=>
a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
s=a+b
x=a*b
if(a>b):
z=a-b
else:
z=b-a
print("Sum = ",s)
print("Product = ",x)
print("Difference = ",z)
---------------------------------------------------------------------
2) Write a python program to check and print the largest number of 3 numbers ?
=>
a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
c=int(input("Enter 3rd no "))
if(a>b and a>c):
m=a
else:
if(b>c):
m=b
else:
m=c
print("Max no = ",m)
22/04/2022
Click here to claim your Sponsored Listing.
Category
Address
Annapurna And MG Road Indore
Indore