return the nth term integer in the sequence 0,0,7,6,14,12,21,18,28,24,35,30......
(suppose the nth term in 5 the output should be 14 or nth term is 9 o/p is 28)
Answers
Answered by
12
Java Programming
//import java.util.Scanner;
class s {
public static void main(String args [])
{
int n= 15;
//System.out.println("enter the value of n:");
//Scanner in=new Scanner(System.in);
//n=in.nextInt();
if (n % 2 == 0)
{
n=((n/2)-1)*6;
System.out.println(n);
}else
{
n=((n-1)/2)*7;
System.out.println(n);
}
}
}
Similar questions