public static void main(String[] args) {
// TODO code application logic here
char a[][]= new char [10][10];
int sommariga=0;
int sommatot=0;
for(int i=0;i<m.length;i++)
{for(int a=0;a<m.length;a++)
{m[i][a]=(char)(Math.random()*100);
if(m[i][a]%2==0)
{m[i][a]='*';
sommariga=sommariga+1;
sommatot=sommatot+1;
}
else
{m[i][a]='O';
}
System.out.print(" "+m[i][a]);
System.out.println();
}
System.out.println("Asterischi riga= "+sommariga);
sommariga=0;
System.out.println();
}
System.out.println("Asterischi totali= "+sommatot);
}
}
}
}
Nessun commento:
Posta un commento