66 897
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #2181 in Java | JSP | JSF for Kamile

Question #2181
Please enter three integer values:
12 15 3
The sum of these numbers is:30

this is how my output suppose to look like, am using Jcreator (JAVA), the values must be added using a loop.Values come from user as well
Expert's answer
import java.util.Scanner;

public class Task {
& public static void main(String[] args)
& {
int result = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Please enter three integer values:");
for(int i = 0; i < 3; i++)
{
if(scan.hasNextInt())
{
& result += scan.nextInt();
}
}
System.out.println("The sum of these numbers is:"+result);
& }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions