Computer Science, asked by Dprajukta, 1 year ago

to print the series in java- 0,3,8,15.....upto 10 terms
to print the series in java - 24,99,224,399....upto 10 terms


Astrobolt: is it okay to just give the loop?
Dprajukta: yes

Answers

Answered by Astrobolt
95
1. I am just giving the loop and necessary variables
int n;
int x = 3;
int s = 0;
for (n=0;n<10;n++)
{
System.out.println(s);
s = s + x;
x = x + 2;
}




2. Again I am only giving the necessary variables and the loop only.
int a;
int y = 75;
int k = 24;
for(a=0;a<10;a++)
{
System.out.println(k);
k = k + y;
y = y + 50;
}
Answered by rekhaverma02021975
22

Answer:

import java.io.*;

class series

{

public static void main(String args[])throws Exception

{

int i ,p;

for(i= 1 ;i<=10;i++)

{

p= (i*i)-1;

System.out.print(p+" ");

}

}

}

Similar questions