Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- #include<math.h>
- using namespace std;
- int funkcia08(int f08[13], int i, int polePrem[13])
- {
- srand((unsigned)time(0));
- for(i=0; i<13; i++)
- {
- f08[i] = (rand()%10);
- }
- for(i=0; i<13; i++)
- {
- cout << f08[i] << " ";
- }
- cout <<endl;
- cout << "Funkcia, ktora scita kazde druhe prvocislo do M, zadaj M: ";
- int M;
- cin >> M;
- int zv;
- for(i = 0; i < M; i++)
- {
- int p = 0;
- for (int b = 1; b <= f08[i]; b++)
- {
- zv = f08[i] % b;
- if (zv == 0)
- {
- p++;
- }
- }
- int prem;
- if (p == 2)
- {
- cout << "ano je prvocislo" <<endl;
- for(prem = 0; prem < M; prem++)
- {
- polePrem[prem] = f08[prem];
- }
- cout << polePrem[prem] << "**";
- }
- else
- {
- cout << "nie nie nie" <<endl;
- }
- }
- return 0;
- }
- int main()
- {
- int f08[13];
- int polePrem[13];
- int i=0;
- funkcia08(f08,i, polePrem);
- system("Pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement