Question

# Share code with your friends

Code

```				```
import java.util.Scanner;

public class Pseudoarithmetic
{
int n,sum,r;
boolean  ans,flag;
int a[];
public Pseudoarithmetic()
{
ans=true;
flag=true;
}
public void accept(int nn)
{
int i=0;
Scanner sc=new Scanner(System.in);
n=nn;
a=new int[n];
System.out.println("Enter" +n + "elements");
for(i=0;i< n;i++)
{
a[i]=sc.nextInt();
}
}
public boolean check()
{
int i=0,j=0;
r=a+a[n-1];
if(n%2==0)
{
for(i=0;i< n/2;i++)
{
if((a[i]+a[n-1-i])!=r)
{
flag=false;
}
}
}
else
{
for(j=0;j<= n/2;j++)
{
if((a[j]+  a[n-1-j])!=r)
{
ans=false;
}
}
}
if(flag==true)
{
sum=n/2*r;
}
if(ans=true)
{
sum=(n/2+1)*r;
}
if(ans==false || flag==false)
{
return false;
}
else
{
return true;
}
}
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter size of sequence");
int nn=sc.nextInt();
Pseudoarithmetic ob1=new Pseudoarithmetic();
ob1.accept(nn);
System.out.println(ob1.check());
}
}

```
```

## Coding Store

Sale ### Mastering String

50
Sale 150
Sale 200
Sale ### Mastering Recursion

50
Sale ### Mastering Numbers

50
Sale ### Mastering Matrix

50
Sale ### Mastering Array

50
Sale ### ISC QUESTION PAPERS WITH SOLUTION(PROGRAMMING ONLY)

50
Sale 50