Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void prostifaktor(int);
- void main()
- {
- int broj;
- cout << "Unesite broj : ";
- cin >> broj;
- cout << broj << " = ";
- prostifaktor(broj);
- system("pause>0");
- }
- void prostifaktor(int br)
- {
- int i = 2;
- while (br != 0) {
- if (br%i == 0) {
- br /= i;
- if (br == 1)
- cout << i << endl;
- else
- cout << i << "*";
- }
- else
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement