You are on page 1of 10

Name - Aniket Jha

Roll no- A24 according to excel sheet

KE158

SET -EVEN SET


1.Return gift

#include <bits/stdc++.h>

using namespace std;

int main()

int t,i;

cin>>t;

for(i=0;i<t;i++){

int a,b,sum=0,temp;

int ani,fac,coun=0;

bool q=true;

cin>>a;

cin>>b;

sum=a+b;

temp=sum;
//for prime number

ani=0;

while(q){

coun++;

fac=0;

for(int j=1;j<=sum;j++){

if(sum%j==0){

fac++;

else{

continue;

if(fac==2)

if(coun==1){

sum=sum+1;

continue;

else{

q=false;

}
}

else{

sum=sum+1;

cout<<sum-temp<<endl;

--------------------------------------------

2.Separate No

#include <bits/stdc++.h>

using namespace std;

int main(){

int x;

cin >> x;

for(int a0 = 0; a0 < x; a0++){

string y;

cin >> y;

bool post=false;

long long int res=0;

if(y[0]=='0'){

string ny="0";

long long int sec=1;


while(ny.size()<y.size()){

ny+=to_string(sec);

sec++;

if(ny==y)

post=true;

else

for(int i=1;i<=(y.size()/2);i++){

res*=10;

res+=(y[i-1]-'0');

long long int sec=res+1;

string ny=y.substr(0,i);

while(ny.size()<y.size()){

ny+=to_string(sec);

sec++;

if(ny==y){

post=true;

break;

if(post&&y.size()>1)

cout<<"YES "<<res<<endl;
}

else

cout<<"NO"<<endl;

return 0;

You might also like