Created
December 17, 2012 12:50
-
-
Save yeahunter/4318068 to your computer and use it in GitHub Desktop.
primszamteszt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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