Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
386 B
9
Indexable
Never
#include <stdio.h>
int main()
{
    int n,num,rem,i=1;
    long long int sum=0;
    scanf("%d",&n);
    int m[n];
    scanf("%d",&num);
    while (num)
    {
        rem=num%10;
        m[n-i]=rem;
        i++;
        num/=10;
    }
    for (int k = 0; k < n; k++)
    {
        sum=sum+m[k];
        
    }
        printf("%lld",sum);
    
    
    return 0;
}