ngak pake lama nih contoh codingnya silakan di coba, moga berguna... apalagy buat tugas anak TI
package asdl;
//menghitung node dengan menggunakan Bollean
import java.util.Scanner;
public class Main {
public static void main(String[] args){
int x;
int relasi = 0;
Scanner node = new Scanner(System.in);
System.out.print("Input Jumlah NODE : ");
int b = node.nextInt();
for(int i=1; i<=b; i++){
for(int j=1; j<=b; j++){
x = i-j;
if (x%2 == 0){
x=0;
} else{
x=1;
relasi++;
}
System.out.println(" "+i+" - "+j+" = "+ (x));
}
}
System.out.println("Jumlah relasi : "+relasi);
}
}
nih outputnya
Create by ; Bertel & Alvin
bg yg merasa berguna tolong beri comment ^_^V
hidup FTI
package asdl;
//menghitung node dengan menggunakan Bollean
import java.util.Scanner;
public class Main {
public static void main(String[] args){
int x;
int relasi = 0;
Scanner node = new Scanner(System.in);
System.out.print("Input Jumlah NODE : ");
int b = node.nextInt();
for(int i=1; i<=b; i++){
for(int j=1; j<=b; j++){
x = i-j;
if (x%2 == 0){
x=0;
} else{
x=1;
relasi++;
}
System.out.println(" "+i+" - "+j+" = "+ (x));
}
}
System.out.println("Jumlah relasi : "+relasi);
}
}
nih outputnya
Create by ; Bertel & Alvin
bg yg merasa berguna tolong beri comment ^_^V
hidup FTI
@
Tagged @ coding java
Tagged @ java
Tagged @ Materi Kulia TI
0 comments:
Post a Comment - Kembali ke Konten