No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I'm a fun-loving, kinda nerdy, frank, kinda shy girl. I love drawing and playing my piano =)) That's my real passion.
- Interests
- drawing, piano, reading, facebook(lol)
2 Posted Topics
Re: Think about this: A prime number has ONLY two factors and those are 1 and the number itself. For eg: Factors of 2 are: 1, 2 Factors of 3 are: 1, 3 Factors of 7 are: 1, 7 and so on..... That should get you started ;) | |
[CODE]//Program to find the sum of the main and right diagonals of a 2D array import java.io.*; public class Diagonals { public static void main(String[]args)throws IOException { int arr[][]={{1,2,3,4},{1,2,3,4},{1,2,3,4},{1,2,3,4}}; int maindiag=0;int rightdiag=0; for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { if(i==j) { maindiag=maindiag+arr[i][j]; } } } System.out.println("The sum of the main diagonal … |
The End.