Computer Science, asked by sefanitmesfin, 3 months ago

program to print the sum of 5+10+15+...+50

Answers

Answered by aryan927735
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