Problem:
Score : 200 points

Problem Statement

An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.

Given an integer N, determine whether it is a Harshad number.

Constraints

1?N?10^8

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print Yes if N is a Harshad number; print No otherwise.

Sample Input 1

12

Sample Output 1

Yes

f(12)=1+2=3. Since 12 is divisible by 3, 12 is a Harshad number.

Sample Input 2

57

Sample Output 2

No

f(57)=5+7=12. Since 57 is not divisible by 12, 12 is not a Harshad number.

Sample Input 3

148

Sample Output 3

No

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>

int main(){
	int N, y;
	scanf("%d", &N);
	int x8 = N % 10^8;
	if (x8 == N){
		x8 = 0;
	}else{y = N-x8/10^8;}

	int x7 = N % 10^7;
	if (x7 == N){
		x7 = 0;
	}else{y = N-x7/10^7;}
	int x6= N % 10^6;
	if (x6 == N){
		x6 = 0;
	}else{y = N-x6/10^6;}
	int x5 = N % 10^5;
	if (x5 == N){
		x5 = 0;
	}else{y = N-x5/10^5;}
	int x4 = N % 10^4;
	if (x4 == N){
		x4 = 0;
	}else{y = N-x4/10^4;}
	int x3 = N % 10^3;
	if (x3 == N){
		x3 = 0;
	}else{y = N-x3/10^3;}
	int x2 = N % 10^2;
	if (x2 == N){
		x2 = 0;
	}else{y = N-x2/10^2;}
	int x1 = N % 10^1;
	if (x1 == N){
		x1 = 0;
	}else{y = N;}
	int ans = y + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8;
	if (N % ans == 0){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}