In the below C code. Write the Output on below table based on code and left side. And also explain the line 7-11 in below code. #include <stdio.h>…
In the below C code. Write the Output on below table based on code and left side. And also explain the line 7-11 in below code.
#include <stdio.h>
int main() {
int n, reversed = 0, remainder, original;
printf("Enter an integer: ");
scanf("%d", &n);
original = n;
while (n != 0) {
remainder = n % 10;
reversed = reversed * 10 + remainder;
n /= 10;
}
if (original == reversed)
printf("%d is a palindrome.", original);
else
printf("%d is not a palindrome.", original);
return 0;
}
| Input | Output |
| 2552 | |
| 6862 |
From the BAPEX Assistant General Manager (ICT) January 2023 – Written (BUET) exam, question 7 of 7.