Submission #2714508


Source Code Expand

using namespace std;
#include <iostream>

int main() {
  int x;
  cin>>x;
  
  int f;
  n = x;
  while (true){
    f += n%10;
    n /= 10;
    if (n==0) break;
  }
  
  cout << (x%f?"No":"Yes") << endl;

  return 0;
}

Submission Info

Submission Time
Task B - Harshad Number
User kjnh10
Language C++14 (GCC 5.4.1)
Score 0
Code Size 237 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:9:3: error: ‘n’ was not declared in this scope
   n = x;
   ^