Reputation: 51
I am trying to find the reverse of the number entered by the user : This is my main.cpp code
int number=0;
cout<< " enter a number";
cin>>number;
reverse( number);
this is my function .cpp code
int reverse( int number){
int last=0;
int i=0;
int array1[10]={0} ;
int check=number;
while ( check!=0){
last=check%10;
array1[i]=last;
i++;
check=number/10;
}
for (int j = 0; j <= i; ++j) {
cout<<array1[j];
}
return 0;
}
It only asks me to enter a number then does not give any output. what should I correct?
Upvotes: 0
Views: 259