Write a Java program to find the area of a triangle.

Write a Java program to find the area of a triangle.

Write a Java program to find the area of a triangle.

Program
import java.util.Scanner;
public class Main 
{
	public static void main(String[] args) 
	{
		Double base,height,area;
		Scanner s=new Scanner(System.in);
		System.out.println("Enter the length of the base of the triangle: ");
		base=s.nextDouble();
		System.out.println("Enter the height of the triangle: ");
		height=s.nextDouble();
		area=0.5*base*height;
		System.out.println(area);
	}

}



Output:

Enter the length of the base of the triangle: 10
Enter the height of the triangle: 15
75.0



More Questions


25 . Write a Java program to add two numbers without using any arithmetic operators
26 . Write a Java program to find the area of a triangle.
27 . Write a Java program to convert kilometers to miles.
28 . Write a Java program to convert Celsius to Fahrenheit.
29 . Write a Java Program to Check if a Number is Positive, Negative or Zero.
30 . Write a Java Program to Find the sum of the digits of a number
31 . Write a Java Program to Calculate electricity bill
32 . Write a Java Program to find Armstrong number
33 . Write a java Program to print Armstrong number between 1 to 1000
34 . Write a java Program to Print given number in words
35 . Write a java Program to check the given number is Palindrome or not



For latest job updates join Telegram Channel: https://t.me/sateeshm