Untitled
unknown
plain_text
a year ago
507 B
2
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); if (num == 0) { sum = 0; } else { 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; }