6.4.. Učitati stranice trougla i naći obim i površinu.

Listing programa :

// 06411083
package zadatak;
import java.util.Scanner;
public class P06411083 {
	public static void main(String[] args) {
    Scanner input = new Scanner (System.in);
   
	System.out.println("Unesi stranice trougla a,b,c");	
	 int a = input.nextInt();
	 int b = input.nextInt();
	 int c = input.nextInt();
	 
	double O= a+b+c;
	System.out.println("O="+O);
	
    double s=O/2;
	System.out.println("s="+s);
		
	System.out.print("P=");
	System.out.println(Math.sqrt(s*(s-a)*(s-b)*(s-c)));
	}

Ispis na ekranu:

Index