Practical3 2
Practical3 2
Roll no : 56
Arithmetic Operators :
print("Arithmatic Operators");
print("8+2=",8+2);
print("8-2=",8-2);
print("8*2=",8*2);
print("8/2=",8/2);
print("8%2=",8%2);
Output:
Logical Operators:
print("Logical Operators");
print("(20 > 10) and (20 < 100):", (20 > 10) and (20 < 100));
print("(15 < 5) and (45 > 5):", (15 < 5) and (45 > 5));
print("(400 > 90) and (5 < 200):", (400 > 90) and (5 < 200));
Output:
Bitwise Operators :
a = 1;
b = 2;
print("Bitwise Operators");
print("~a:", ~a);
print("~b:", ~b);
Output :
Exercise:
Q.1 Write a program to convert U.S. dollars to Indian rupees.
i_rs = us * 85.81
Output:
import math
print("Finding Square Root")
num = int(input("Enter the number to find the square root: "))
root = math.sqrt(num)
print("Square root of", num, "is", root)
Output:
Q.4 Write a program to find the area of Rectangle.
l = int(input("Enter the length: "))
b = int(input("Enter the breadth: "))
area = l * b
print("Area of Rectangle:", area)
Output:
Q.5 Write a program to calculate area and perimeter of the square
print("Area & Perimeter of Square")
print("Perimeter of square:", sq * 4)
Output:
Output: