Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void wpisz(int tablica [], int ile)
- {
- for(int i=0; i<ile; i++)
- {
- cout << "podaj liczbe nr " << i; // taki tylko prosty trick żeby śledzić którą liczbę wpisujesz
- cin >> tablica[i];
- }
- }
- void sprawdz(int tablica[], int ile) //po co ten argument x?
- {
- for (int x=0; x<=ile; x++ ) //zastanów się nad warunkiem przerwania
- {
- for(int i=2; i*i<=tablica[x]; i++)
- {
- if (tablica[x]%i==0){
- cout<<"liczba" << tablica[x] << "nie jest pierwsza"; // jak już wypisujesz to wypisz w ten sposób
- break;
- } // jakieś przerwanie
- // znowu nie jest miałeś
- if (i*i>tablica[x]) {cout<<" jest kurwa ";
- }
- }
- }
- }
- int main()
- {int ile;
- cout<<"podaj ilosc licz do sprawdzenia";
- cin>>ile;
- int dane [ile];
- wpisz (dane,ile);
- sprawdz (dane,ile);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement