I wrote something but ı have to enter 2 times. also ı want to add cod next prime number - previous prime number I tried a lot, but I couldn't.

Code:

#include <iostream>
using namespace std;
int main()
{
int i,j=2,number,count,num,x;
cout<<"Enter number ";
cin>>number;
cin>>num;
for(i=number+1;i<3000;i++)
{
for(j=2;j <i;j++)
{
if(i %j==0)
{
break;
}
}
if(i==j || i==1)
{
cout<<"\t"<<i;
break;
}
}
for( int a=num-1;a>=1;a--)
{
for(int b=2;b<a;b++)
{
if(a%b==0)
count++;
}
if(count==0)
{
if(a==1)
{
cout<<"no prime number less than 2";
break;
}
cout<<a<<" last prime and next prime number before entered number"<<endl;
break;
}
count=0;
}
return 0 ;
}