adesuryadi_

Array Dinamis

Nov 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. package opboti3;
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author PC25
  13. */
  14. public class ArrayDinamis {
  15. public static void main(String [] args){
  16. Scanner scanner = new Scanner (System.in);
  17. System.out.print("Masukan text = ");
  18. String input = scanner.nextLine();
  19. System.out.println("Inputan = "+input);
  20.  
  21.  
  22. System.out.print("Masukan Banyak Baris = ");
  23. String i = scanner.nextLine();
  24. System.out.print("Masukan Banyak kolom = ");
  25. String j = scanner.nextLine();
  26.  
  27. int m = Integer.parseInt(i);
  28. int n = Integer.parseInt(j);
  29. int x,y;
  30. for(x=0;x<m;x++){
  31. for(y=0;y<n;y++){
  32. System.out.print("*");
  33.  
  34. }
  35. System.out.println("");
  36. }
  37. System.out.print("Masukan banyak Angka : ");
  38. String l = scanner.nextLine();
  39. int q = Integer.parseInt(l);
  40. int total=0;
  41. for(int w=0;w<q;w++){
  42. System.out.print("Masukan Bilangan ke-"+(w+1)+" : ");
  43. String h = scanner.nextLine();
  44. int r = Integer.parseInt(h);
  45. total += r;
  46.  
  47. }
  48. System.out.println("Hasil dari Penjumlahan "+q+" Bilangan adlah "+total);
  49. }
  50. }
Add Comment
Please, Sign In to add comment