SOURCE CODE
import java.io.*;
public class TripelPhytagoras
{
public static void main(String[] args) throws IOException
{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
int a,b,c,f,g,h,i;
System.out.println("");
System.out.println("Menentukan apakah 3 bilangan itu triple phytagoras");
System.out.println("Jika A2 = B2 + C2");
System.out.println("");
System.out.print("Nilai A : ");
a = Integer.parseInt(input.readLine());
System.out.print("Nilai B : ");
b = Integer.parseInt(input.readLine());
System.out.print("Nilai C : ");
c = Integer.parseInt(input.readLine());
System.out.println("");
f=a*a;
g=b*b;
h=c*c;
i=g+h;
if(f==i){
System.out.println(a + " " + b + " " + c +" merupakan triple phytagoras");
} else {
System.out.println(a + " " + b + " " + c +" bukan merupakan triple phytagoras");
}
}
}
OUTPUT
Output Bukan Triple Phytagoras |
Output Triple Phytagoras |
Sumber from my friend https://serverrendi.blogspot.co.id
0 Response to "Java - Menentukan Bilangan Phytagoras"
Post a Comment