i am able to get the right answer with my code but i am getting testcase 1 as worng answer
THE PROBLEM IS IN THIS QUESTION-
PRATEEK LOVES CANDY
UNABLE TO FIND WHAT's WRONG
#include using namespace std; int main() { int i,j,k,num,c; cin>>j; for(i=1;i<=j;i++) { cin>>num; if(num!=1) { c=(num*2)+1; cout<<c<<endl; } else { c=num+1; cout<<c; } } return 0; } my code
Hey Satvik, you are getting this question wrong, you have to print Nth prime number not (N*2)+1.
for eg. check for this
input:
1
2
correct output : 3
as 3 is 2nd prime number.