Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace gyak_konnyu
- {
- class Prima
- {
- private int _Generalt_szam;
- public Prima(int z)
- {
- this._Generalt_szam=Generalt_szam;
- }
- public void Prime_e(int a)
- {
- int primek = 0;
- for (int i = 0; i < 101; i++)
- {
- if (a % i == 0)
- {
- primek++;
- Console.WriteLine("A szám prím");
- }
- else
- {
- Console.WriteLine("A szám nem prím");
- }
- }
- Console.WriteLine("Osztok száma:{0}",primek);
- }
- public int Generalt_szam
- {
- get
- {
- return _Generalt_szam;
- }
- set
- {
- _Generalt_szam = value;
- if (value%2!=0 || value<100)
- {
- }
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- int c = rnd.Next(99);
- for (int i = 0; i < c; i++)
- {
- if (c % 2 != 0)
- {
- Prima b = new Prima(c);
- b.Prime_e(c);
- Console.Write("Feladat:{0}",b.Prime_e(c));
- }
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement