Program 11: Sum of Digits 🔢 🔢 Aim: Write a program to find the sum of digits of a number. #include <stdio.h> int main() { int n, sum=0; scanf("%d",&n); while(n>0){ sum += n%10; n /= 10; } printf("Sum = %d", sum); return 0; } Input: 1234 Output: Sum = 10
Program 12: Palindrome Number 🔄 🔄 Aim: Write a program to check whether a number is palindrome or not. #include <stdio.h> int main() { int n, r=0, t; scanf("%d",&n); t=n; while(n>0){ r=r*10+n%10; n/=10; } if(t==r) printf("Palindrome"); else printf("Not Palindrome"); return 0; } Input: 121 Output: Palindrome