Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sum-Of-Array-in-Java #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SumOfArray/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions SumOfArray/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

463 changes: 463 additions & 0 deletions SumOfArray/.idea/dbnavigator.xml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions SumOfArray/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions SumOfArray/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions SumOfArray/SumOfArray.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file added SumOfArray/out/production/SumOfArray/Main.class
Binary file not shown.
42 changes: 42 additions & 0 deletions SumOfArray/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
int[][] A= new int[3][3];
int[][] B=new int[3][3];
int[][] sum=new int[3][3];

Scanner sc = new Scanner(System.in);

System.out.println("Enter numbers of A[][] array :");
for (int i=0; i< A.length; i++) {
for (int j = 0; j < A.length; j++) {
A[i][j]=sc.nextInt();
}
}

System.out.println("Enter numbers of B[][] array :");
for (int i=0; i< B.length; i++) {
for (int j = 0; j < B.length; j++) {
B[i][j]=sc.nextInt();
}
}
// sum of array
for (int i=0; i< A.length; i++) {

for (int j = 0; j < B.length; j++) {
sum[i][j]=A[i][j]+ B[i][j];
}
}

// display sum of array
System.out.println("The sum of A[][] and B[][] is ");
for (int i=0; i< A.length; i++) {

for (int j = 0; j < B.length; j++) {
System.out.print(sum[i][j]+",");
}
System.out.println(" ");
}
}
}