Can anyone tell me the use of 1st loop in below code | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Can anyone tell me the use of 1st loop in below code

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int length = scanner.nextInt(); int[] array = new int[length]; for (int i = 0; i < length; i++) { array[i] = scanner.nextInt(); } //your code goes here int sum = 0; for(int i=0; i<array.length; i++){ if(array[i]%4==0){ sum+=array[i]; } } System.out.print(sum); } }

13th Aug 2022, 7:39 AM
UTKARSH JAMBHULKAR
UTKARSH JAMBHULKAR - avatar
2 ответов
+ 4
apparently it reads integer numbers and stores them in the Array array.
13th Aug 2022, 7:49 AM
Tina
Tina - avatar
+ 1
Thanks
13th Aug 2022, 7:49 AM
UTKARSH JAMBHULKAR
UTKARSH JAMBHULKAR - avatar