Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Find the sum of digits of a number using a while loop.
#include <stdio.h> int main() { int n, sum = 0; scanf("%d", &n); while (n > 0) { sum += n % 10; n /= 10; } printf("Sum = %d\n", sum); return 0; }
1234
Sum = 10