print the java series 0,3,8,15..........99 by while loop
Answers
Answered by
5
Hello mate ,
In this BlueJ program the series 0,3,8,15,24,…… will be displayed up to ‘n’ elements.
Codes of the program is given below:
class Position
{
int i,x=0,b=3;
public void show(int n)
for(i=0;i< n;i++)
{
System.out.print(" "+x);
x=x+b;
b=b+2;
In this program, the series shows that a values starting from 3 is added to its previous value and the sum is displayed. The value which is added to the previous value in the series is incremented by ‘2’ and the operation of display, add and increment is continued.
In this BlueJ program the series 0,3,8,15,24,…… will be displayed up to ‘n’ elements.
Codes of the program is given below:
class Position
{
int i,x=0,b=3;
public void show(int n)
for(i=0;i< n;i++)
{
System.out.print(" "+x);
x=x+b;
b=b+2;
In this program, the series shows that a values starting from 3 is added to its previous value and the sum is displayed. The value which is added to the previous value in the series is incremented by ‘2’ and the operation of display, add and increment is continued.
shibangi86:
Thanks mate
Answered by
5
Class Find
{
public static void main(Stringargs[])
{
int i = 1 ;
do
{
System.out.print( i * i - 1);
i++ ;
} while ( i<=10)
}
}
Hope This Helps....
Mark as Brainliest....
{
public static void main(Stringargs[])
{
int i = 1 ;
do
{
System.out.print( i * i - 1);
i++ ;
} while ( i<=10)
}
}
Hope This Helps....
Mark as Brainliest....
Similar questions