Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package learning;
- import java.util.Scanner;
- public class Learning
- {
- public static void main(String[]args)
- {
- Scanner scanner = new Scanner(System.in);
- int[] npm = {70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89};
- String[] mahasiswa = {"Joni", "Andi", "Siti", "Eliana", "Mira", "Vina", "Tuti", "Tono", "Yanto", "Asti",
- "Ryan", "Doni", "Yandi", "Tanti", "Suryo", "Eko", "Mike", "Neil", "Rocky"};
- int x = 0;
- System.out.println("Silahkan masukkan npm sebanyak 10 kali");
- while(x<10) //This looping for user can input NPM 10 times only
- {
- int inputNpm = scanner.nextInt();
- for(int i=0;i<npm.length;i++)
- {
- if(inputNpm == npm[i])
- {
- System.out.println(mahasiswa[i] + "\n");
- }
- }
- x++;
- }
- System.out.println("--- SELESAI ---"); //If total input of NPM is 10, this statement is gonna be printed
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement