bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

pc009.c (544B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Sum of digit */
      8 
      9 #include <stdio.h>
     10 int main()
     11 {
     12     int num, sumOfDigit = 0, temp;
     13     printf("Enter the number : ");
     14     if (scanf("%d", &num) != 1)
     15     {
     16         printf("\nOnly a number is allowed.");
     17         return 1;
     18     }
     19     temp = num;
     20     while (temp > 0)
     21     {
     22         sumOfDigit += temp % 10;
     23         temp /= 10;
     24     }
     25     printf("\nSum of the digit %d : %d", num, sumOfDigit);
     26     return 0;
     27 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror