Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public class elo
  2. {
  3. public static void main(String [] args)
  4. {
  5. int l = 0;
  6. int x = 0;
  7. int m = 10;
  8. int n = 10;
  9. char tab[][] = new char[m][n];
  10. for(int i = 0; i<m; i++)
  11. for(int j = 0; j<n; j++)
  12. tab[i][j] =(char)('a'+(int)(Math.random()*26));
  13.  
  14. boolean f = checkdiagonal(tab,n,m,x,l);
  15. System.out.println(f);
  16. }
  17.  
  18. static boolean checkdiagonal(char tab[][],int n,int m, int x,int l)
  19. {
  20. char maxValue = tab[0][0];
  21. char tab1[][] = new char[m][n];
  22. for(int i = 0; i<m; i++)
  23. {
  24. for(int j=0;i<n;j++)
  25. tab1[i][j]=tab[i][j];
  26. }
  27.  
  28.  
  29. for(int i = 0; i <m; i++){
  30. if(tab1[i][x]>maxValue){
  31. tab1[i][x] = maxValue;
  32. }
  33. x++;
  34. }
  35. int c = 0;
  36. for(int i=0; i<m;i++,c++){
  37. if(tab[i][x]==tab1[i][x])
  38. l++;
  39. }
  40. if(l==10)
  41. return true;
  42.  
  43. else
  44. return false;
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement