print
Advertisment
Advertisment

Area of Rhombus

Example

import java.util.Scanner;
class Raj{

 public static void main(String[] args) {
 
  int d1;
  int d2;
  float area;
  Scanner sc = new Scanner(System.in);

   System.out.println("Enter the values of diagonals (d1 and d2):");

    d1 = sc.nextInt();
    d2 = sc.nextInt();

     area = (float)((d1*d2)/2);

    System.out.println("Area of rhombus ="+area);

    }
  }
  

Output :

 
      
  Enter the values of diagonals (d1 and d2):
  10
  20
  Area of rhombus =100.0 
  
Advertisment
Advertisment
arrow_upward