#include<stdio.h>#include<math.h>int main(){ int n,temp,sum=0,rem; scanf("%d",&n); temp=n; while(temp!=0) { rem=temp%10; sum=sum+rem; temp=temp/10; } printf("The sum of digit of %d is %d\n",n,sum); return 0;}
No comments