Computer Science, asked by sudarshansatpute01, 11 months ago

Write a C++ program to find whether the given number is a Harshad number or not. Note that Harshard number is an integer that is divisible by the sum of its digits.

Answers

Answered by sabihahmad
7

Answer:

I can give u a python code for that

Explanation:

comment if u want

and mark me brainliest

Answered by bipinvjohn
17

#include <iostream>

using namespace std;

int main()  

{  

   int num,sum = 0;  

   cin>>num;

   int n = num;  

   while(num > 0)

   {  

       int rem = num%10;  

       sum = sum + rem;  

       num = num/10;  

   }      

   if(n % sum == 0)  

       cout <<"Harshad Number";  

   else  

       cout <<"Not Harshad Number";

   return 0;  

}

Similar questions