bsc

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

P033.c (640B)


      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 /* WAP to calculate the sum of even digits and odd digits. Number will be provided by user. */
      8 
      9 #include <stdio.h>
     10 int main()
     11 {
     12     int inp, odd = 0, even = 0, temp;
     13     printf("Enter the number : ");
     14     scanf("%d", &inp);
     15     temp = inp;
     16     while (temp > 0)
     17     {
     18         if ((temp % 10) % 2 == 0)
     19             even += temp % 10;
     20         else
     21             odd += temp % 10;
     22         temp /= 10;
     23     }
     24     printf("\nSum of even : %d"
     25            "\nSum of odd : %d",
     26            even, odd);
     27     return 0;
     28 }
© 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