Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
OliDesu authored Feb 10, 2022
1 parent 56887e6 commit 245f68f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions NaturalNumbersSum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
public class NaturalNumbersSum {
public static void main(String[] args){
int tab[]= {1,2,3,4,5,6};
System.out.println(sumOfNaturalNumbers(tab));
}
public static int sumOfNaturalNumbers(int[] tab){
int sum = 0;
for(int i =0; i < tab.length;i++){
sum = sum + tab[i];
}
return sum;
}
}

0 comments on commit 245f68f

Please sign in to comment.