Computer Science, asked by Anonymous, 1 year ago

Write a program to find the following series upto n terms 15,31,47...

Answers

Answered by Anonymous
1

import java.util.*;

public class Series

{

public static void main(String args[ ])

{

Scanner in=new Scanner (System. in);

int a=16,b,c,n;

System.out.println("Enter the value of n");

n=in.nextInt();

for(b=1;b<=n;b++)

{

c=(a*b)-1;

System.out.println("The series is ="+c);

}

}

}

In the given series it is the subtractive result of 1 from the multiples of 16

Such that,

(16×1)-1

=16-1

=15

(16×2)-1

=32-1

=31

(16×3)-1

=48-1

=47

And vice versa.

Similar questions