JavaProgram StdIX
JavaProgram StdIX
Class IX (2023-24)
Perform the Programs and write the code in your Computer Notebook:
4. W.A.P. to find the area and perimeter of a rectangle; taking values from
the user
Ans:
class Rectangle
{
public static void main(int a, int b)
{
int ar=0, pr=0;
ar=a*b; //calculate the area
pr=2*(a+b); //calculate the perimeter
System.out.println("Area of rectangle: " + ar);
System.out.println("Perimeter of rectangle: " + pr);
}
}
6. W.A.P. to find the area of the triangle. Take the input of base and height
from the user.
9. Write the above program 8; taking value of the bill from the user.
13. W.A.P. using the escape sequences to display height, weight of 4 students