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.
1
Expert's answer
2017-02-22T10:06:05-0500
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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS