niven numbers are positive integers greater than 0 that are divisable by the sum of their digits.for example 42 is a niven number,it is divisable by 4+2=6,you given a function,static int checkNivenNumber(int n);
Answers
Answered by
2
Answer:
Input format:
Input consists of 1 integer.
If the given number is Harshad Number display Harshad Number or display Not Harshad Number.
Sample Input:
1729
Sample Output:
Harshad Number
Algorithm to check whether a number is Harshad number or not
Get the input from the user
Find the sum of its digits.
If the number is divisible by the sum of its digits, print "Harshad Number".
Else, display "Not Harshad Number".
Similar questions