- masuk
- masukkan input s1
- masukkan input s2
- proses(masukkan rumus luas trapesium luas=1/2*jumlah sisi sejajar(s1+s2)*t
- cetak hasil luas
- selesai
flowchart:
source code:
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Lukman
*/
public class LuasTrapesium {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner trapesium=new Scanner(System.in);
System.out.print("masukan nilai s1: ");
int s1=trapesium.nextInt();
System.out.print("masukan nilai s2: ");
int s2=trapesium.nextInt();
System.out.print("masukan nilai t: ");
int t=trapesium.nextInt();
double lu= (s1+s2)*(t*0.5);
System.out.print("maka luas trapesium adalah:" +lu);
// TODO code application logic here
}
}
Tidak ada komentar:
Posting Komentar