Hi all... i need to do some study regarding how to count the multiple int that keep in by user like this :-
"Please enter the integer :
1
3
5
66
88
(1+3=4+5=9+66=75+88=163 - the program will terminted cause exceed than 100)
how to do ?...i stuck very long here...below is the coding that i make;;hope u will help me;;;
import java.io.*;
import java.util.Scanner;
public class Soalan1
{
public static void main ( String [] args ) throws IOException //throw any exceptions
{
BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );
//note the previous line. you can write the statements 2 and 3 in a single line
// 2&3. Create a single shared BufferedReader for keyboard input.
int a,n, sum;
sum = 0;
System.out.println( "KEEP IN THE INTEGER ! " );
while (true)
{
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
sum = sum + n;
if (sum >= 100)
{
// n is zero, so break out of the enclosing while loop
break;
}//end if
}//end while
System.out.println(execeed 100 = "+ sum +" )");
// System.out.printf( "Sum is %d\n", sum ); // display sum
//
} // end main method
} // end class calc