1
The problem is this:
a function takes an int as parameter, and returns it written backwards and another to test whether the input number and the inverted number is palindromic or not.
I was able to solve the problem of identifying if the input number is palindromic, but I still have to divide the code into functions according to what was requested.
So far my code is like this:
int i, j;
scanf("%d", &i);
int n = i;
int l = 0;
while(n != 0){
j = n % 10;
l = (l * 10) + j;
n = n / 10;
}
if(i == l)
printf("sim");
else
printf("nao");
And the code is not as you want ? What was missing ? The palindromo part works correctly. Just test with some numbers like
313
,123
,123321
– Isac
not to be as I intended. what I have no difficulty with is splitting the code into function. for example: int inverts...
– Denilson Silva
Choose a better name than
l
for your variable. In monospaced fonts (which we use to program) looks like the digit1
.– Gabriel
@Gabriel, has practice of using variables in this sequence,(regardless of the problem), i, j, l, m, n, o ..., but I comment on each one depending on the problem.
– Denilson Silva