bsc

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

root / semester_1 / tuition-c / P032.c

P032.c (494B)


      1 /* WAP to input a number and check whether it is a Niven number
      2 or not. (When a number is divisible by its sum of digit) e.g. : n = 126*/
      3 
      4 #include <stdio.h>
      5 int main()
      6 {
      7     int n, temp, sod = 0;
      8     printf("Enter the number : ");
      9     scanf("%d", &n);
     10     temp = n;
     11     while (temp > 0)
     12     {
     13         sod = sod + (temp % 10);
     14         temp = temp / 10;
     15     }
     16     if (n % sod == 0)
     17         printf("\nIt is Niven number.");
     18     else
     19         printf("\nIt is not a Niven number.");
     20     return 0;
     21 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror