- Get link
- Other Apps
Programming Questions with source code Program 1: Program to obtain side of a square and then calculate its area. Input code: a=int(input("Enter the side of square:")) sq=a**2 print("Area of square is :",sq) Program 2: Program to obtain length and breadth of a rectangle and calculate its area. Input Code: l=int(input("Enter length of the rectangle:")) b=int(input ("Enter breadth of the rectangle:")) area=l*b print("Area of rectangle is:",area) Program 3: Program to obtain height and base of a triangle and calculate its area. Input Code: l=int(input("Enter length of triangle")) b=int(input("Enter base of triangle")) area=0.5*b*h print("Area of triangle is:",area) Program 4: Program to obtain a number and print its square and cube. Input Code: num=float(input("Enter the number:")) sq=num*num cube=num*num*num print("Square of",num,"is",sq) print("Cube of",num,&q