Академический Документы
Профессиональный Документы
Культура Документы
NIM: 1507112651
1.1
Tugas 1
1.1.1 Program Tugas 1
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no1;
/**
*
* @author user
*/
public class No1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int nilai = 95;
System.out.println("Nilai " + nilai);
if(nilai > 75) {
System.out.println("Lulus");
} else {
System.out.println("Tidak Lulus");
}
}
}
1.1.2
Screenshoot
2.1
Tugas 2
lima");
if(nilai%5 == 0) {
System.out.println("Nilai kelipatan
} else {
System.out.println("Nilai bukan kelipatan
lima");
}
}
2.1.2
Screenshoot
3.1 Tugas 3
3.1.1 Program Tugas 3
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no3;
import java.util.Scanner;
/**
*
* @author user
*/
public class No3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
3.1.2
Screenshoot
4.1 Tugas 4
4.1.1 Program Tugas 4
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no4;
import java.util.Scanner;
/**
*
* @author user
*/
4.1.2
Screenshoot
5.1 Tugas 5
5.1.1 Program Tugas 5
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no5;
/**
*
* @author user
*/
public class No5 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i = 0;
do {
System.out.println( i + "Java");
i++;
} while(i < 10);
i=0;
System.out.println();
while(i<10) {
System.out.println( i + "Java");
i++;
}
}
}
5.1.2
Screenshoot
6.1 Tugas 6
6.1.1 Program Tugas 6
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no6;
/**
*
* @author user
*/
public class No6 {
/**
6.1.2
Screenshoot
7.1 Tugas 7
7.1.1 Program Tugas 7
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no7;
/**
*
* @author user
*/
public class No7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int bilangan1 = 7;
int bilangan2 = 8;
int prima1 = 1;
int prima2 = 1;
int i = 2;
do {
if(bilangan1%i == 0) {
prima1 = 0;
}
} while(i != 2);
if(prima1 == 1) {
System.out.println(bilangan1 + "
Merupakan bilangan prima");
} else {
System.out.println(bilangan1 + " Bukan
bilangan prima");
}
while(i <= 3) {
if(bilangan2%i == 0) {
prima2 = 0;
}
i++;
}
if(prima2 == 1) {
System.out.println(bilangan2 + "
Merupakan111 bilangan prima");
} else {
System.out.println(bilangan2 + " Bukan
bilangan prima");
}
}
}
7.1.2
Screenshoot
8.1 Tugas 8
8.1.1 Program Tugas 8
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no8;
/**
*
* @author user
*/
public class No8 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i = 0;
int j = 4;
do {
8.1.2
Screenshoot
9.1 Tugas 9
9.1.1 Program Tugas 9
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no9;
/**
*
* @author user
*/
public class No9 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
for(int i=1; i<=5; i++) {
System.out.printf("%d ",i);
}
System.out.println();
}
}
9.1.2
Screenshoot
10.1
Tugas 10
10.1.1 Program Tugas 10
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no10;
/**
*
* @author user
*/
public class No10 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i;
int j = 1;
10.1.2 Screenshoot
11.1 Tugas 11
11.1.1 Program Tugas 11
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no11;
/**
*
* @author user
*/
public class No11 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
for(int i=1; i<=5; i++) {
for(int j=1; j<=i; j++) {
System.out.printf("%d",i);
}
System.out.println();
}
System.out.println();
}
}
11.1.2 Screenshoot
12.1
Tugas 12
12.1.1 Program Tugas 12
/*
* To change this license header, choose License
Headers in Project Properties.
* To change this template file, choose Tools |
Templates
* and open the template in the editor.
*/
package no12;
/**
*
* @author user
*/
public class No12 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
for(int i=5; i > 0; i--) {
for(int j=1; j<=i; j++) {
System.out.printf("%d",i);
}
System.out.println();
}
System.out.println();
}
}
12.1.2 Screenshoot