PRINT REVERSE
Take N as input, Calculate it’s reverse also Print the reverse.
Constraints:
0 <= N <= 1000000000
Sample Input:
123456789
Sample Output:
987654321
Explanation:
You’ve to calculate the reverse in a number, not just print the reverse.
code
#include
using namespace std;
int main() {
int n,a,reverse=0;
cin >> n;
if((n>=0) &&(n<=1000000000))
{
cout<<“wrong input”;
}
while(n!=0)
{
a=n%10;
reverse=(reverse*10)+a;
n=n/10;
}
cout<<reverse;
}
output on hacker blocks
wrong input0
problem : it is not asking for input from user even if code has it and all the test cases are going wrong