program to print the sum of 5+10+15+...+50
Answers
Answered by
0
Answer:
import java.util.*;
public class Sum
{
public static void main (String args [])
{
int sum ;
for (int i = 5; i<=50; i = i + 5)
{
System.out.print (i + " + ") ;
sum = sum + i ;
}
System. out.println ("\nSum = " + sum)
}
}
Similar questions