Can anyone help me with this console application? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone help me with this console application?

Hi, So I have this excercise that I gotta make but i’m stuck I wrote a code for a user to give 20 random numbers. But now I have to give the sum of the 5th, 10th and 15th number. I heard other people talk about arrays but I didnt learn that yet at school. It was one week before I was gonna learn Arrays and lists. So can anyone help me with this problem? Is there another way for me to find the sum? Btw im using c#

7th Oct 2018, 7:24 PM
TJ Herdigein
TJ Herdigein - avatar
1 Answer
0
Yes, you can use only "for": s=0; for(i=0; i<20; i++){ // random if(i%5==0 && i>0) s+= /* your random*/; }
7th Oct 2018, 7:54 PM
Petr Leliaev
Petr Leliaev - avatar