#Help please
4 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @rugged dune! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
package MyPackage;
import java.util.Scanner;
public class Insert {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int[][] arrayok = new int[3][3];
int sumof1 = 0;
int sumof2 = 0;
int sumof3 = 0;
System.out.print("Enter The Numbers:\n");
for(int row = 0; row > 3; row += 1){
for(int col = 0; col > 3; col += 1){
System.out.print("Enter Value: ");
arrayok[row][col] = input.nextInt();
}
}
for(int row = 0; row < 3; row += 1){
for(int col = 0; col < 3; col += 1){
if(row == col){
sumof1 += arrayok[row][col];
}
if(row < col){
sumof2 += arrayok[row][col];
}
if(row > col){
sumof3 += arrayok[row][col];
}
}}
System.out.print("\nThe sum of diagonal elements is "+sumof1);
System.out.print("\nThe sum of upper elements is "+sumof2);
System.out.print("\nThe sum of lower elements is "+sumof3);
/*
The first is not taking the numbers from users. i mean its not working properly.. help..
*/
}
}
can you be more specific about how exactly it isn't working