write a program to check whether no is neven no or not??? plz correct answer only if don't know so not give..
Share
write a program to check whether no is neven no or not??? plz correct answer only if don't know so not give..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
Method:
static boolean isNiven(int number)
{
// calculate sum of digits
int sum = 0;
for (int temp = number; temp > 0; temp /= 10)
sum += temp % 10;
// Return true if sum of digits is multiple of number
return (number % sum == 0);
}