Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Tabla {
- private static Random rndm = new Random();
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int[][] tabla = new int[7][7];
- int aux;
- for (int i=0; i <7;i++) {
- for (int j=0; j<7;j++) {
- if(i==j) {
- tabla[i][j] = 1;
- }else {
- aux = rndm.nextInt(99);
- while(esPar(aux)) {
- aux = rndm.nextInt(99);
- }
- tabla[i][j] = aux;
- }
- System.out.print(" ");
- System.out.print(tabla[i][j]);
- System.out.print(" ");
- }
- System.out.println();
- }
- }
- public static boolean esPar(int num) {
- if ((num%2)==0) return true;
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement