Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n, m, k = 0, broj;
- Console.Write("Unesite n = ");
- n = int.Parse(Console.ReadLine());
- Console.Write("Unesite m = ");
- m = int.Parse(Console.ReadLine());
- for (int i = n; i <= m; i++)
- {
- broj = i;
- if (broj == 1)
- {
- k++;
- }
- for (int j = 2; j <= i; j++)
- {
- while (broj % j == 0)
- {
- broj = broj / j;
- k++;
- }
- if (broj == 1)
- {
- break;
- }
- }
- }
- Console.WriteLine("Broj prostih cinilaca je " + k);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement