Sum of the digits of a number is called persistent.For eg,6 is persistent of 123.In this program each and every digit is extracted by dividing the number by 10.The remainder obtained after this process is added into sum.The number is then decremented by dividing it by 10.This process continous until the number decrements to 0.

#include < stdio.h > #include < conio.h > void main() { int n,p=0; clrscr(); printf("Enter the number\n"); scanf("%d",&n); while(n!=0) { p=p+(n%10); n/=10; } printf("The persistent is %d",p); }