Computer Science, asked by rathidikshu4780, 2 months ago

Write a Java program to find the number of
and sum of all integers greater than 100 and
less than 200 that are divisible by 8.

Answers

Answered by Kalihacker
2

Answer:

import java.util.List;

import java.util.ArrayList;

public class Main {

public static void main(String[] args) {

int sum=0;

List<Integer> obj=new ArrayList();

for (int i=100;i<201;i++) {

if (i%8==0) {

obj.add(i);

} else {

continue;

}

}

System.out.println(obj.size());

for (int i=0;i<obj.size();i++) {

sum += obj.get(i);

}

System.out.println(sum);

}

}

Answered by 2002sathishj
0

Write a Java program to find the number of

and sum of all integers greater than 100 and

less than 200 that are divisible by 8.

Similar questions