Write a program that computes the sum of the first ten positive integers,
1 + 2 + • • • + 10. Write a program of the form
public class Sum10
{
public static void main(String[] args)
{
System.out.println();
}
}
1
Expert's answer
2013-07-23T09:33:15-0400
//Write a program that computes the sum of the first tenpositive //integers, //1 + 2 + • • • + 10. public class Sum10 { public staticvoid main(String[] args) { System.out.println(sum(1,10)); }
public staticint sum(int start, int end) { int res=0; for (int i = start; i <= end; i++) { res+=i; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment