+ 1

Can anyone help me please.

Write java program to input 100 integer number and print the addition of it

11th Feb 2021, 7:48 AM
Rishabh Tiwari
Rishabh Tiwari - avatar
7 Respuestas
+ 5
import java.util.Scanner; public class addition { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter 100 integer number:"); int n, sum = 0; for(int i = 1; i<=100; i++) { n = sc.nextInt(); sum = sum+n; } System.out.println(sum); } } Here is right one! Actually mistake was in {} and ,
12th Feb 2021, 3:27 AM
Abhiyantā
Abhiyantā - avatar
+ 4
Rishabh Bhai, first show your attempts!
11th Feb 2021, 7:49 AM
Abhiyantā
Abhiyantā - avatar
+ 4
You can the input and print statements execute in for loop.
11th Feb 2021, 8:14 AM
JaScript
JaScript - avatar
+ 2
thank you bhai
12th Feb 2021, 8:45 AM
Rishabh Tiwari
Rishabh Tiwari - avatar
+ 1
Wait i am just doing and posting it
11th Feb 2021, 7:50 AM
Rishabh Tiwari
Rishabh Tiwari - avatar
0
import java.util.Scanner; public class addition { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter 100 integer number:"); int n; sum = 0; { for(int i = 1; i<=100; i++) n = sc.nextInt(); sum = sum+n; } System.out.println(sum); } }
11th Feb 2021, 5:30 PM
Rishabh Tiwari
Rishabh Tiwari - avatar
0
Brother i have written this
11th Feb 2021, 5:31 PM
Rishabh Tiwari
Rishabh Tiwari - avatar