I have an error but i can't correct it
#include <iostream>
using namespace std;
long reverse (long num, long equation,long reverse = 0);
int main()
{
long num, reverse = 0;
cout << "Enter the num: ";
cin >> num;
cout << "Reverse num is = "
<< reverse << endl;
return 0;
}
long reverse(long num, long equation, long reverse = 0)
{
while (num)
{
equation = num % 10;
reverse = (reverse *
10) + equation;
num = num / 10;
return reverse;
}
}
#include <iostream>
using namespace std;
long reverse (long num);
int main ()
{
long num;
cout << "Enter a number ::::: ";
cin >> num;
cout << "Reverse of entered number is ::::: "
<< reverse(num) << endl;
return 0;
}
long reverse (long num)
{
long equation, reverse = 0;
while(num)
{
equation = num % 10;
reverse = (reverse*10) + equation;
num = num/10;
}
return reverse;
}
/**************** OUTPUT OF PROGRAM **************
Enter a number ::::: 1234567809
Reverse of entered number is ::::: 9087654321
*************************************************/
Get Answers For Free
Most questions answered within 1 hours.