Java write a program to calculate the sum of each of the series:(a)1+4+9+16+...to 20terms.

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 20:53:19
Java write a program to calculate the sum of each of the series:(a)1+4+9+16+...to 20terms.
xk@GOٝ:."f/zatw$GHBڞzU_lb#zȼ}eDM[F8 Qcrp R>c( sPY:)cܮF!MҹA(X]q&C_%>\+vމR&%7k!0)iv;6Ҭ.Ygs6A΄9~0jZ mԵ18p7Q#da/}=?9?9x񡘞?|eA$߂JO9VQ\&p/v/go8[jp[9)١+]_`>};{?\Jſnq|5`be`wsHY_nZ~ \Yofʆ2"h/Ԙ>:t bNuIצ=Ý724jIl5m

Java write a program to calculate the sum of each of the series:(a)1+4+9+16+...to 20terms.
Java write a program to calculate the sum of each of the series:(a)1+4+9+16+...to 20terms.

Java write a program to calculate the sum of each of the series:(a)1+4+9+16+...to 20terms.
import java.util.Scanner;
public class Sum {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// 创建一个输入容器
Scanner input = new Scanner(System.in);
System.out.println("输入一个开始数:");
int start = input.nextInt();
System.out.println("输入想计算的个数:");
int end = input.nextInt();
Sum s = new Sum();
int sum = s.sum(start,end);
System.out.println("答案是:" + sum);
}
public int sum(int start,int end) {
int sum = 0;
int sum2 = 0;
for (int i = 0; i < end; i++) {
sum = sum + 1 + 2 * i;
sum2+=sum;
}
return sum2;
}
}

Please write a Java program,compute the GreatestCommonDivisor求JAVA程序 Java write a program to calculate the factorial of any natural number entered by a user. write a program to represent multiplication tables.用最简单的JAVA语言. Java write a program to read an integer,n,from the keyboard and output n row of pascal's triangle. Write a program,which performs as the following:(java)Write a program,which performs as the following:Create two interfaces Automobile and Nonautomobile.They contain abstract methods AutomobileMotionMode( ) and NonautomobileMotionMode( ).Create a Java write a program to calculate the sum of each of the series:(a)1+4+9+16+...to 20terms. 求会英文的java大神帮忙解决一道编程题Write a program that will ask a user for the total hours worked.If the hours worked Java编程、输入数字个数、平均数、最小值、最大值减去最小值、write a JAVA program to read in a sequence of integers and print out the following quantities,each on a new line and in the following order,your program should be:1) Java编程、输入数字个数、平均数、最小值、最大值减去最小值、write a JAVA program to read in a sequence of integers and print out the following quantities,each on a new line and in the following order,your program should be:1) 帮忙编写一个java程序(很基础的那种).Write a program which accepts a time interval in seconds and prints the equivalent time in hours minutes seconds.One hour is 3600 seconds and one minute is 60 seconds. how to write this java program?write an application that prints the phrase Knowledge is power:a.on one line b.on three lines,one word per line,with the words ccentered relative each otheri want to know how to write an application,not the meaning in 英语翻译JabpLite 1.30 S60v3Jabp is a banking program for mobile devices.The idea behind JabpLite has been to write a sophisticated personal finance program in Java MIDP which will work on a range of devices including Symbian phones.JabpLite has m count how many numbers?java count question 这道题怎么写 write a program that declares and creates an array of 9 integers containin the following values :{ 1.-2,16,40,15,26,47,18,-9} .then,the program should ,using a loop ,count how many numbers 一道Java的题目 求编程Problem Description:Write a program that reads integers,findsthe largest of them,and counts its occurrences.Assume that the input endswith number 0.Suppose that you entered 3 5 2 5 5 5 0; the program finds thatthe largest two Java problemsQuestion:Write a program which asks the user two numbers and the calculation (+, - , * or /) to be performed. The program shall print the calculation as well as the answer. Take care of the situation the divisor being zero.My answer: how to write this java programthe question is:The height of an object dropped from a starting height of 100 meters is govern by the equation h=100-4.9*t^2 where t is the time in seconds.Write a program that asks the user for a time less than 20 secon 这道java题怎么用while语句做,详见问题补充,求大神帮忙!Write a program segment that reads a sequence of integers until a 0 is encountered. For each number read, output the number of times the number can be divided by 2 before you get java编程问题 急In rolling a dice one of the six sides will appear uppermost.If a dice is rolled many thousands of times,each of the six sides should appear uppermost approximately the same number of times.Write a program that counts the number o