Write a loop that prints a \'division grid\' showing what numbers (from 1-25) ac
ID: 3672242 • Letter: W
Question
Write a loop that prints a 'division grid' showing what numbers (from 1-25) across the top are divisible by the number on the left (also from 1-25). If the number on the top axis is even, and the grid location below is activated, mark that spot with an "E", else mark that location with an "O". Is there a Flowchart showing the steps that should be taken in the code? Is the flowchart representative of the Code that was submitted? Docs the program run? Docs it loop correctly from 1 to 25? Docs it indicate those cells which are divisible properly? Docs it the EVEN/ODD indicator work correctly? BONUS POINTS: For 10 Extra Bonus Points, prompt the user for the maximum number to put into the grid. NOTE, this program should be done in plain text, meaning you DO NOT have to, and SHOULD NOT print grids. You should only need the Characters 0-9, "E", "O", " " (space), and CarriageRetums (Enter)Explanation / Answer
This is the which I have executed under net beans IDE:
package evenodd;
public class EvenOdd {
static int ii;
public static void main(String[] args) {
char matrix[][]=new char[50][50];
int[] row=new int[50];
int[] colomn=new int[50];
int i,j,k=0;
System.out.print(" ");
do{
for(i=0;i<25;i++)
{
row[i]=i+1;
System.out.print(" "+(row[i]));
}
System.out.println();
}while(k>25);
System.out.println();
for(i=0;i<25;i++)
{
colomn[i]=i+1;
System.out.print(colomn[i]);
for(ii=0;ii<25;ii++)
{
System.out.print(" ");
for(j=0;j<25;j++){
if((row[j]%colomn[i])==0){
matrix[ii][j]='E';
System.out.print(" "+matrix[ii][j]);
}
else if((row[j]%colomn[i])==1)
{
matrix[ii][j]='O';
System.out.print(" "+matrix[ii][j]);
}
else
{
matrix[ii][j]=' ';
System.out.print(" "+matrix[ii][j]);
}
}
System.out.println();
break;
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.