find Area of a parallelogram in java

A parallelogram is a four sided shape formed by two pairs of parallel lines like a rectangle. Opposite sides of a parallelogram should be equal. How can we find the area of a parallelogram manually?



Calculate Area of a parallelogram in java

Area of a parallelogram = base x height.

This is a simple java console program to find area of a parallelogram with the measures of height and base.

Program code:


import java.io.*;
class parallelogram
{
public static void main(String p[]) throws IOException
   {
         BufferedReader Br = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("\n Enter the base : ");
         int a =Integer.parseInt(Br.readLine());
    System.out.print("\n Enter the lenght : ");
         int b=Integer.parseInt(Br.readLine());
         System.out.println( "\n Area of parallelogram with base "+a+" and lenght " +b+ " is :" + a*b);
}
}


Sample output:

Find calculate in java to area of a parallelogram




No comments:

Post a Comment