Given a
number N. Find if it can be expressed as
sum of two prime numbers.
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer N as input.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer N as input.
Output:
For each test case, In new line print "Yes" if it can be expressed, Otherwise print "No".
For each test case, In new line print "Yes" if it can be expressed, Otherwise print "No".
Constraints:
1<=T<=2000
1<=N<=106
1<=T<=2000
1<=N<=106
Example:
Input:
2
34
23
Input:
2
34
23
Output:
Yes
No
Yes
No
Solution:
#include
<iostream>
using
namespace std;
int
main() {
int n,j=0;
cin>>n;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
if(a%2==0&&a>2)
cout<<"Yes"<<endl;
else
{
a=a-2;
for(j=2;j<=a/2;j++)
if(a%j==0)
break;
if(j==a/2+1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}
return 0;
}