Computer Science, asked by ridhimavaid2007, 1 day ago

Write a java program without scanner class to print 10 terms of series 1, (1+2), (1+2+3), ...
note : don't spam ​

Answers

Answered by ItzMeSam35
3

import java.util.*;

public class k

{

public static void main (String args [])

{

int a = 1 ;

int b = (1+2);

int c = (1+2+3);

int d = (1+2+3+4);

int e = (1+2+3+4+5);

int f = (1+2+3+4+5+6);

int g = (1+2+3+4+5+6+7);

int h = (1+2+3+4+5+6+7+8);

int i = (1+2+3+4+5+6+7+8+9);

int j = (1+2+3+4+5+6+7+8+9);

int k = a+b+c+d+e+f+g+h+I+j;

System.out.println(k);

}

}

Attachments:
Similar questions