Reverse a given number

#include
#include<math.h>
using namespace std;

int main()
{
int newno,n,i,count;
cin>>n;

int r=0;
newno =0;
int p=10;

while(n>=0)
{
	count++;
	n=n/10;
}
count=count-1;

while(n>0)
{
	r=n%10;
	for(i<=count;i=0;i--)
	{
		newno=newno+pow(p,count);
	}
	n=n/10;

}

cout<<newno;
return 0;

}

WHY DOES IT NOT RUN??
ALSO PLEASE PROPOSE THE EFFICIENT WAY TO SOLVE IT ALONGWITH ITS ALGORITHM.

Hey @dsdishu99 this does not run because in the first loop n cannot become less then zero so it’ll remain in the first while loop, hence it results in TLE.
An efficient approach to solve this question is to access the last element and multiply it by 1 and access the second last element multiply the previous answer by 10 and add the second element and so on. For more help please refer to the given code