Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. package za;
  2.  
  3. import java.util.Random;
  4. import java.util.Scanner;
  5.  
  6. public class qqqqqq {
  7.  
  8. public static void main(String[] args) {
  9. // TODO Auto-generated method stub
  10. Scanner wejscie = new Scanner(System.in);
  11.  
  12. System.out.println("Podaj imię");
  13. String imie = wejscie.nextLine();
  14. System.out.println("Witaj " + imie);
  15.  
  16.  
  17. Scanner wejscie1 = new Scanner(System.in);
  18.  
  19. System.out.println("Podaj swój rok urodzenia");
  20. int wiek = wejscie1.nextInt();
  21. int r;
  22. r=2017-wiek;
  23. System.out.println("Masz "+ r +" lat.");
  24.  
  25. Random los = new Random();
  26. int [][]tab=new int[8][10];
  27. for(int i=0;i<=7;i++){
  28. for(int j=0;j<=9;j++){
  29. if(i==1){
  30. tab[i][j]=los.nextInt(8);
  31. System.out.print(tab[i][j]+" ");}
  32. else if (i==0){
  33. tab[i][j]=los.nextInt(51);
  34. System.out.print(tab[i][j]+" ");}
  35. else if (i==2){
  36. tab[i][j]=1;
  37. System.out.print(tab[i][j]+" ");}
  38. else
  39. System.out.print(tab[i][j]+" ");
  40. } System.out.println();
  41.  
  42. }System.out.println();
  43.  
  44. System.out.print(MAX(tab));
  45. }
  46. public static int MAX(int tab[][])
  47. {
  48. int MAX = tab [0][0];
  49. for(int i=0; i<8; i++)
  50. {
  51. for(int j=0; j<10; j++)
  52. {if (tab[i][j]>MAX)
  53. MAX = tab[i][j];
  54.  
  55. }
  56. }
  57. return MAX;
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement