# Find the 15th term of the series? 0,0,7,6,14,12,21,18

Question 0 Find the 15th term of the series? 0,0,7,6,14,12,21,18 Please add the answer in the comment section below.
`#include <stdio.h>int a1(int x);int a2(int y);void main(){  int n;  scanf("%d",&n);  if(n%2==0)  a1(n/2);  else    a2(n/2+1);}int a1(int x){int s=0;for(int i=0;i<x-1;i++){s=s+6;}printf("%d",s);}int a2(int x){int s=0;for(int i=0;i<x-1;i++){s=s+7;}printf("%d",s);}`
`//C++ Program#include <iostream>using namespace std;int main(){	//we would be init. the variables here	int val, extra;	cout<<"Enter the term you want to print: ";	//user input	cin>>val;	//logic for merging to different patterns	if(val==0||val==1)	{			cout<<0;			return 0;	}	else if(val%2==0)	{		val=val/2;		extra=6;			}	else	{		val=val/2+1;		extra=7;	}	//the code brain ends here	//now, we will print o/p	cout<<(val-1)*extra;	return 0;}`
`import java.util.Scanner;public class Series{public static void main(String args[]){Scanner sc=new Scanner(System.in);int n;n=sc.nextInt();int arr[]=new int[n];int i,k=0;int a=0,b=0;arr[0]=a;k++;arr[1]=b;k++;for(i=1;i<=n-2;i++){if(i%2!=0){a=a+7;arr[k]=a;k++;}else{b=b+6;arr[k]=b;k++;}}System.out.print(arr[n-1]);}}`
`val = int(input('enter the number: '))x=0y=0for i in range(1,val+1):if(i%2!=0):x= x+7else:y = y+6if(val%2!=0):print(' {} term in accordance to the program is {}'.format(val,x-7))else:print('{} term in accordance to the program is {}'.format(val,y-6))`

### 6 comments on “Find the 15th term of the series? 0,0,7,6,14,12,21,18”

• Priti kumari

public class Fifteen
{

public static void main(String[] args)
{

int a[]=new int[20];
int k=0;
for(int i=0;i<9;i++)
{
for(int j=0;j<2;j++)
{
if(i+1%2==0)
{
a[k]=i*7;
k++;
}
else
a[k]=i*6;
k++;
}
}
System.out.println(a[14]);
}

}

• Shardul Negi

//Find the 15th term of the series?
//0,0,7,6,14,12,21,18, 28
#include
void main()
{

int i=0,j=0,k=0,l=0,m=0,lt;
for(i=0,j=1;i<15;i+=2,j+=2){

k=7*m;
l=6*m;
//printf("%d %d ",k,l);
m++;
lt=l;
}
printf("%d",lt);
}

• siva ganesh

#include
int main()
{
int n,t,d,a;
scanf(“%d”,&n);
if(n%2==1)
{
a=0;
d=(n/2)+1;
t=a+(d-1)*7;
printf(“%d”,t);
}
else
{
a=0;
d=(n/2);
t=a+(d-1)*6;
printf(“%d”,t);
}
return 0;
}

• Raushan Jha

import java.util.*;
class SeriesAP2
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
if(n==1 || n==2)
{
System.out.println(“0″);
}
if(n>=3)
{
if(n%2!=0)
{
n=n/2;
int tn1=7+(n-1)*7;
System.out.println(tn1+” “);
}
else
{
n=n/2-1;
int t2=6+(n-1)*6;
System.out.println(t2+” “);
}
}
}
}

• soumen pramanik

#include
int a1(int x);
int a2(int y);
void main()
{
int n;
scanf(“%d”,&n);
if(n%2==0)
a1(n/2);
else
a2(n/2+1);
}
int a1(int x)
{
int s=0;
for(int i=0;i<x-1;i++)
{
s=s+6;
}
printf("%d",s);
}
int a2(int x)
{
int s=0;
for(int i=0;i<x-1;i++)
{
s=s+7;
}
printf("%d",s);
}