#include <stdio.h>

int main()
{//c program to find sum of digits
    int num,sum,k,num1;
    sum=0;
    printf("Enter the number\n");
    scanf("%d",&num);
    num1=num;
    
    for(num1=num;num1>0;)
    {
        k=num1%10;
        sum=sum+k;
        num1=num1/10;
    }
    printf("Sum of digits is %d",sum);

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: