Number fibonacci check

if(num==0||num==1)
cout<<“Fibonacci Number”<<endl;
else
{

	while(nth<=num)
	{
		nth=a+b;
		a=b;
		b=nth;
	
	}
}

if(a==num)
	cout<<"\nFibonacci Number";
else
	cout<<"Not a Fibonacci Number";

I wrote the above code and it gave correct answer. Is there any better or simpler way to find out?