for(row = 0 ; row < size ;row++){
result = 0;
for (col = 0 ; col < size ; col++)
result = matrix[row][col] +result;
magic = result;
sumRows[row]= result;
if...
Type: Posts; User: Macgrubber
for(row = 0 ; row < size ;row++){
result = 0;
for (col = 0 ; col < size ; col++)
result = matrix[row][col] +result;
magic = result;
sumRows[row]= result;
if...
result = 0;
for(row = 3 ; row >= 0; row--){
result = matrix[row][row] +result;
}
sumDiag2 = result;
if (sumDiag2 == magic){
System.out.println("Minor Diagonal = "+ sumDiag2 + ...
int [] [] matrix = {
{16, 3, 2, 13},
{5, 10, 11, 8},
{2, 6, 7, 12},
{2, 15, 14, 1}
};
result = 0;
oh thanks its working now...
so all i needed to do is get rid of the +" "; after the array
thank you and yeah thanks again for the advice ill be more careful next time with my practices..
and...
System.out.print("\nList 2 : ");
for (i = 0 ; i<list.length ; i++){
list2 [i] =(int)(99*Math.random()+1);
System.out.printf("\n%2d",list2[i] + " ");
}
i want to display random nos. with a...
it doesnt work because if a number with 1 digit comes up then the alignment will be all messed up... :( need help my instructor specifically told us to watch out for the alignments...
i think its...
System.out.print("\nList 2 : ");
for (i = 0 ; i<list.length ; i++){
list2 [i] =(int)(99*Math.random()+1);
System.out.printf(list2[i], " %2d");
}
i have this code... i want to align...
im doing a for loop that goes like this.... for (i=1 , i<=30000 , i++)
ok but want to printout a result every 1000 of the time.... how to do that.. please..
o yeah thanks that was some big of a help.... :)
it works if i the 1st number i enter is positive but if you enter a negative number 1st then it has problems :(
their initialized to 0 because if the user enters the first number.. it checks the number if its <0 or >0 then it enters the loop...
so can you tell me whats wrong? i cant seem to determine... thanks i didnt realize that problem now im even more confused.... :(
i have this program.. basically it keeps reading an integer until the user inputs 0... then it outputs the count of positives and negatives, the sum of the postives and the negatives, largest values...