using System;
using System.Linq;
using System.Text.RegularExpressions;
namespace MyCompiler {
class Program {
public static void Main(string[] args)
{
Console.WriteLine(Moran(3030));
}
public static string Moran(int str)
{
int sum = Array.ConvertAll(str.ToString().Select(x => x.ToString()).ToArray(),Convert.ToInt32).Sum();
int output = str / sum;
string res = str % sum == 0 ? "Harshad" : "Neither";
Console.WriteLine("before for {0}",res);
for(int i =2; i < output;i++)
{
if(output % i == 0)
{
res = res == "Harshad" ? "Harshad" : "Neither";
return res;
}
}
res = res == "Harshad" ? "Moran" :res ;
return (res);
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: