Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Autor: Kacper Malinowski" << endl;
- cout << "Tytul: Czy liczba jest pierwsza czy zlozona?" << endl;
- int n;
- int i=2;
- char powt;
- for(;;){
- cout << "Podaj n: ";
- cin >> n;
- for(;;){
- if(i==n){
- cout << "n jest liczba pierwsza";
- break;
- }
- else{
- if(n%i==0){
- cout << "n jest liczba zlozona";
- break;
- }
- else{
- i=i+1;
- }
- }
- }
- cout << endl << "Czy powtorzyc dla innej liczby (T/N): ";
- cin >> powt;
- if(powt=='N'){
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement