ShriRam Changed status to publish July 15, 2022
#include<stdio.h> */ void main() { int n,r=0,n1; printf("Enter Number : "); scanf("%d",&n); n1=n; while(n!=0) { r=r*10; r=r+n%10; n=n/10; } if(n1==r) printf("%d is Palindrome",n1); else printf("%d is not Palindrome",n1); getch(); } C6-Q10 WAP TO Check number is Armstrong or not(Hint=An Armstrong number, also known as narcissistic number, is a number that is equal to the sum of the cubes of its own digits, for example,370 is an Armstrong number since 370=3*3*3+7*7*7+0*0*0). #include #include /*WAP TO Check number is Armstrong or not (Hint=An Armstrong number, also known as narcissistic number, is a number that is equal to the sum of the cubes of its own digits. For example,370 is an Armstrong number since 370=3*3*3+7*7*7+0*0*0) */ void main() { int n1,n,r,sum=0; printf("Enter Number : "); scanf("%d",&n); n1=n; while(n>0) { r=n%10; sum=sum+r*r*r; n=n/10; } if(sum==n1) printf("%d is Armstrong",n1); else printf("%d is not Armstrong",n1); getch(); }
ShriRam Changed status to publish July 15, 2022