Computer Science, asked by hermoinegranger7, 1 year ago

37,50,65...........170
FIND THE SERIES(JAVA BASED )

NO SPAMING........
else \: i \: will \: delete \: your \: answer


hermoinegranger7: java class 8
hermoinegranger7: yes

Answers

Answered by mihirthemega
0

class series1

{

     public static void main( )

     {

          int a = 37, b = 13;

          while (a<=170)            

                   {

                         System.out.println(a);              

                         a = a+ b;        

                         b = b+ 2;

                       }

             }

}

If you found the answer to be helpful, please mark as the brainliest!



hermoinegranger7: tell me the logic na
mihirthemega: see in the edits
mihirthemega: in comments in java
mihirthemega: see thing is simple, take one variable for storing, whose initial value is 37
mihirthemega: take a loop which runs to 170
mihirthemega: take one more variable and increase its value by 2 every time the loop runs
mihirthemega: add this variable with the storing variable
mihirthemega: so, pattern is like this:
mihirthemega: 37 + (11 + 2), 37 + (11 + 2) + {(11 + 2) + 2}, 37 + (11 + 2) + {(11 + 2) + 2} + [{(11 + 2) + 2} + 2]
mihirthemega: Gramerci
Similar questions