answersLogoWhite

0

// Get input

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

String input = in.readLine();

in.close();

// Parse input

int sum = 0;

StringTokenizer parser = new StringTokenizer(input);

while (parser.hasMoreTokens()) {

int currentInt = Integer.parseInt(parser.nextToken());

System.out.println(currentInt);

sum += currentInt;

}

System.out.println("sum = " + sum);

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Which software program displays advertising on your computer?

youtube


C program that displays integers 1 TO 9?

#include <cstdio> int main() { int x = 1; while(x < 10) { printf("%d ", x); x++; } char wait; scanf("%s", wait); return 0; }


What is a rectangular box that displays information or a program?

A screen (VDU).


What displays the name of the document and the name of the program?

title bar


Write a c program which displays digital watch on the screen after taking the hours and minutes from the user?

Write a program which displays digital watch on the screen, after taking the hours and minutes from the user.


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


How can one assign a list of integers in Java?

Put statements at the start of ones code will allow one to have a list of integers in their Java program. If one does this then they will successfully have integers in their code.


What is the rectangular box that displays information or a program on windows 7?

a window


Write a shell program that adds the integers 1 to 100 and displays the result with a suitable message?

#!/bin/bashs=0c=1while [$c-le 100]dos='expr $s + $c'c='expr $c + 1'doneecho "Sum of 1 to 100 is $s"


Write a program in c that prompt user with following lines add two integers test an integer for odd or even and quit?

write a program in C that prompts the user with the following lines: a) Add two integers c) Compare two integers for the larger t) Test an integers for odd or even q) Quit


How do you reverse of the answer program integers in C programming?

sense question Your makes no.


What displays the program name and the name of the document being edited?

title bar