Computer Science, asked by naveen17bei302, 1 year ago


In recreational mathematics, a Niven number in a given number base, is an integer that is divisible by the sum of its digits when written in that base. For example, in base 10, 18 is a Niven number since 18 is divisible by 1+8 = 9. Also, 12001 in base 3 is also a Niven number since the sum of the digits is 4 (which is 11 in base 3) divides 12001 (12001 = 1021 x 11).

Answers

Answered by abdulrehman310otuf2h
1
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int n,d,a,sum=0;
printf("\n Enter the number :");
scanf("%d",&n);
a=n;
while(a>0)
{
d=a%10;
sum=sum+d;
a=a/10;
}
if(n%sum==0)
printf("\n The number is Harshard Number");
else
printf("\n The number is not a Harshard Number");
getch();
    return 0;
}


Similar questions