Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cmath>
- using namespace std;
- bool czypierwsza (int xx)
- {
- for( int i=2;i<xx;i++)
- {
- if(xx%i==0) return false;
- return true;
- }
- }
- int main()
- {
- int x;
- cout << "Podaj liczbe do faktoryzacji: " ;
- cin>> x;
- int i=2;
- do
- {
- while(x%i==0)
- {
- x=x/i;
- cout<<i<<endl;
- }
- i++;
- while(czypierwsza(i)==false)
- {
- i++;
- }
- }
- while(x>1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement