Harshad number

PHOTO EMBED

Wed Oct 25 2023 17:38:20 GMT+0000 (Coordinated Universal Time)

Saved by @yolobotoffender

#include <iostream>
#include<iomanip>
using namespace std;
int main() {
    int rem,sum=0,num;
    cout<<"enter  a number\n";
    cin>>num;
 
 for(int i=num;i>0; i = i/10 ){
     rem = i%10;
     sum = rem+sum;
     
     
 }
 if (num%sum==0){cout<<"harshad number"<<endl;}
 else cout<<"non harshad"<<endl;
 
  
  
  
  return 0;
}
content_copyCOPY