60 426
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #65449 in Java | JSP | JSF for gazibo

Question #65449
2. Write an application that sums the integers from 1 to 50 (That is, 1+2+3…+50). Save the file as Sum50.java.
Expert's answer
public class Sum50 {
public static void main(String[] args) {
int sum=0;
for(int a=0; a<=50; a++)

{
sum+=a;
}

System.out.println("The sum of 1 from 50 is: " +sum);

}
}

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