问几个菜问题# Java - 爪哇娇娃
p*m
1 楼
Question 1
Write a complete Java program that will prompt the user to enter two numbers
. The program should add together all the numbers from the first number to t
he second number.
Some details:
Input: Input two integer numbers via JOptionPane.
Forumula: Use the below formula to calculate the sum
sum = (n/2)*(2*a+(n-1)); where n is the number of terms to be added; a is th
e first number.
Output: Output the two numbers and the total of the sum using System.out.pri
ntln(). Also, output your nam
Write a complete Java program that will prompt the user to enter two numbers
. The program should add together all the numbers from the first number to t
he second number.
Some details:
Input: Input two integer numbers via JOptionPane.
Forumula: Use the below formula to calculate the sum
sum = (n/2)*(2*a+(n-1)); where n is the number of terms to be added; a is th
e first number.
Output: Output the two numbers and the total of the sum using System.out.pri
ntln(). Also, output your nam