Kasus "Mencari rata-rata nilai uas"
Masukan nama
Masukan nomor induk
Masukan nilai uas
Coding :
import java.util.Scanner;
public class Task {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner nilai=new Scanner(System.in);
System.out.println("Masukan Nama = ");
String a=nilai.next();
System.out.println("Masukan nomor induk = ");
int b=nilai.nextInt();
System.out.println("Masukan nilai uas I = ");
int c=nilai.nextInt();
System.out.println("Masukan nilai uas II = ");
int d=nilai.nextInt();
System.out.println("Masukan nilai uas III = ");
int e=nilai.nextInt();
int hasil=c+e+d;
int rata=hasil/3;
System.out.println("Nama = "+a);
System.out.println("Nomor induk = "+b);
System.out.println("rata-rata uas 1-3 = "+rata);
}
Setelah di Run file