#include<stdio.h>
int sumdigits(int n){
    int sum=0;
    while(n!=0){
        sum=sum+n%10;
        n=n/10;
    }
    printf("%d",sum);
}
int main(){
    int n=123;
    sumdigits(n);
}

Embed on website

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