Advertisement
Telor_Goreng0

nomor 3 pertemuan 4

Apr 24th, 2021
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. package pertemuan4;
  3. public class nomor3 {
  4. public static void main ( String [] args ){
  5. System.out.println("program rekursif menghitung Nomor Pokok Mahasiswa User hingga NPM 1 ");
  6. System.out.println("====================================================================");
  7. int NPM = 92;
  8. System.out.println("NPM Sian Nadao Sinaga = "+ NPM);
  9. System.out.println("\nhitungan Nomor Pokok Mahasiswa sebagai berikut ini ");
  10. System.out.println("====================================================================");
  11. hitung_Nomor_Pokok_Mahasiswa(NPM);
  12. }
  13. private static void hitung_Nomor_Pokok_Mahasiswa( int NPM ){
  14. System.out.println(" Nomor Pokok Mahasiswa Ke-" + NPM+ "= " + NPM);
  15. if( NPM==1){
  16. return;
  17. }
  18. NPM--;
  19. hitung_Nomor_Pokok_Mahasiswa(NPM);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement