answersLogoWhite

0

WAP to print sum and average of multiples of 5 from 500 to 600?

Updated: 6/18/2023
User Avatar

Abhiabhishek052000

Lvl 1
15y ago

Best Answer

public class Test {

public static void main(String[] args){

int i = 500;

int sum = 0;

int avg = 0;

int counter = 0;

do {

i = i + 5;

sum = sum + i;

counter = counter + 1;

} while (i

User Avatar

Telly Bgm & Songs

Lvl 2
10mo ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

public class Test {

public static void main(String[] args){

int i = 500;

int sum = 0;

int avg = 0;

int counter = 0;

do {

i = i + 5;

sum = sum + i;

counter = counter + 1;

} while (i <= 600);

System.out.println("Sum: " + sum);

avg = sum/counter;

System.out.println("Average: " + avg);

}

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: WAP to print sum and average of multiples of 5 from 500 to 600?
Write your answer...
Submit
Still have questions?
magnify glass
imp