BINTANG MERAH

Jumat, 23 November 2012

Coding Netbeans nilai rata-rata

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication5;

import java.util.Scanner;

/**
 *
 * @author gaara
 */
public class JavaApplication5 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner masuk=new Scanner(System.in);
        int nim,nilai_1,nilai_2,nilai_3,Rata_rata;
        String nama,kelas;
       
        System.out.print("nama : ");
        nama=masuk.nextLine();
       
       
        System.out.print("nim : ");
        nama=masuk.nextLine();
       
        System.out.print("kelas : ");
        nama=masuk.nextLine();
       
        System.out.print("nilai ke 1 : ");
        nilai_1=masuk.nextInt();
       
        System.out.print("nilai ke 2 : ");
        nilai_2=masuk.nextInt();
       
        System.out.print("nilai ke 3 : ");
        nilai_3=masuk.nextInt();
       
        Rata_rata=(nilai_1+nilai_2+nilai_3)/3;
       
        System.out.print("rata-rata : " + Rata_rata);
       
       
               
       
    }
}

Tidak ada komentar:

Posting Komentar