Function
Function
*** Palindrome
Input 121
Reverse 121
The number 121 remains the same when its digits are reversed. *******
#include<stdio.h>
int amstrong(n) // Function declare
{
while(n>0)
{
m=n%10;
sum=sum+m*m*m;
n=n/10;
}
printf("Sum is=%d",sum);
}
int main()
{
printf("Enter a number:");
scanf("%d",&n);
amstrong(n); // Function call
if(n==sum)
printf(“ the number is amstrong”);
else
printf(“the number is not amstrong”);
}
OUTPUT
Enter a number
153
the number is amstrong
Enter a number
123
the number is not amstrong
Output
Before swapping 10 20
After swapping 10 20