Any solution for this problem? I need the sum of the multiples and the average :( | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Any solution for this problem? I need the sum of the multiples and the average :(

import java.util.Scanner; public class JavaApplication4 { public static void main(String[] args) { Scanner var=new Scanner(System.in); int i; int sum3=0; for (i=1;i<=51;i++) { System.out.println(i*3+""); } System.out.println("xx\n sum of the multiples off three:"+sum3); System.out.println("x/ average off three:"+(float)sum3/50); }

3rd Oct 2017, 5:31 PM
craig
craig - avatar
1 Answer
0
first off all check ur closing braces and then include the following line in for loop under output statement..u r good to go :) sum3 = sum3 + i;
3rd Oct 2017, 5:40 PM
Suhail Pappu
Suhail Pappu - avatar