Program No 1:
Length and breadth of a rectangle are 5 and 7 respectively. Write a program to calculate the area and perimeter of the rectangle.
package its.a.program;
import java.util.Scanner;
public class ItsAProgram {
public static void main(String[] args) {
//area and paremeter of rectangle
int length=5;
int breadth=7;//putting values of varaibles
double area=length*breadth;
double perimeter=2*(length+breadth);
System.out.print("Area is =");
System.out.println(area);
System.out.print("Perimeter of rectangle is =");
System.out.println(perimeter);
}
}
Program NO 2:
Write a program to calculate the perimeter of a triangle having sides of length 2,3 and 5 units
package its.a.program;
import java.util.Scanner;
public class ItsAProgram {
public static void main(String[] args) {
//perimeter of a triangle
Scanner sc=new Scanner (System.in);
System.out.print("Enter 1st number =");
int firstSide=sc.nextInt();
System.out.print("Enter 2nd number =");
int secondSide=sc.nextInt();
System.out.print("Enter 3rd number =");
int thirdSide=sc.nextInt();
double perimeter =firstSide+secondSide+thirdSide;
System.out.print("Perimeter is ="+perimeter);
}
}
Program NO 3:
Program NO 4:
Write a program to check if the two numbers 23 and 45 are equal.
package its.a.program;
public class ItsAProgram {
public static void main(String[] args) {
//check if the two numbers 23 and 45 are equal.
int a=23;
int b=45;
System.out.print(a==b);
}
}



