Skip to content

Instantly share code, notes, and snippets.

@yeahunter
Created December 17, 2012 12:50
Show Gist options
  • Save yeahunter/4318068 to your computer and use it in GitHub Desktop.
Save yeahunter/4318068 to your computer and use it in GitHub Desktop.
primszamteszt
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace suli_prim_teszt
{
class Program
{
static void Main(string[] args)
{
primSzamE(12);
}
public static bool primSzamE(int szam)
{
int hanyszor = 0;
for (int i = 1; i <= szam; i++)
{
double eredmeny = Convert.ToDouble(szam) / Convert.ToDouble(i);
int eredmeny2 = szam / i;
if (eredmeny == eredmeny2)
hanyszor++;
//label1.Text = eredmeny.ToString();
//label2.Text = eredmeny2.ToString();
Console.WriteLine("{0} / {1} = {2} | {3}", szam, i, eredmeny, eredmeny2);
}
Console.WriteLine(hanyszor);
//label2.Text = hanyszor.ToString();
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment