top of page

Array for the summer!

Writer: Amulya Malapaka
Amulya Malapaka
Jul 30, 2018
1 min read

Welcome back everyone! Today, let's have some fun with arrays. an array is just the programming term to describe a list! For example a programmer may define an array under a variable. For example(in Java):


int intArr = {1, 2, 3, 4, 5, 6, 7};


Today's challenge is to write a program that will add these numbers up. A few weeks ago, we got a response that added two numbers in Java. This time, you will be adding more numbers! In order to make this happen, a for loop may come in handy. Here is a good website if you need a refresher on loops!(for Java, but can come in handy for other "Java-like languages")http://www.learnjavaonline.org/en/Loops


To go with the challenge, here is a link to another tea recipe that should keep you healthy! Fun fact: Turmeric improves your ability to grow and learn!


https://www.allrecipes.com/recipe/242148/ginger-turmeric-herbal-tea/?internalSource=hub%20recipe&referringId=17150&referringContentType=recipe%20hub


See you in a little while!


Amulya :)

 
 
 

Recent Posts

See All
Well it's been a while, huh.

Welcome back girls and boys, we're in for a fun ride :) As the end of the school year approaches us I'm sure we're excited for a summer...

 
 
 
THANKSGIVING!

IT'S THANKSGIVING!!! Want to know what I'm thankful for? I'm thankful for the beautiful weather we've been having.(Yes that was...

 
 
 

5 Comments


lubeck1089
lubeck1089
Nov 12, 2018

//not exactly adding numbers, but instead concatenating my name :)


String[][] meArr= {{"e", "l", "i"},{"z", "a", "b"},{"e", "t", "h"}};

String total = "";

for(int i = 0; i < meArr.length; i++)

{

for(int j = 0; j < meArr[0].length; j++)

total += meArr[i][j];

}

System.out.print(total);

Like

Manasi Mangalvedhe
Manasi Mangalvedhe
Sep 24, 2018

Input : arr[] = {1, 2, 3, 4, 5, 6, 7}

Output: 28

1 + 2 + 3 + 4 + 5 + 6 + 7 = 28

Like

Amulya Malapaka
Amulya Malapaka
Aug 10, 2018

Nice use of java!

Like

Amulya Malapaka
Amulya Malapaka
Aug 10, 2018

Thank you Neil!

Like

Neil Palleti
Neil Palleti
Aug 3, 2018

My approach would be this:


int sum = 0;

for (int i = 0; i < intArr.length; i++) {

sum += intArr[i];

}

System.out.println(sum);

Like
bottom of page