Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n1, n2,p1;
- cout << "unesi raspon od do " << endl;
- cin >> n1;
- cin >> n2;
- if (n1 > n2)
- {
- n3 = n1;
- n1 = n2;
- n2 = n3;
- }
- for (int j = n1; j <= n2; j++)
- {
- if (j == 1)
- {
- p1 = 1;
- }
- else if(j==2)
- {
- p1 = 2;
- }
- else
- {
- for (int i = 2; i < j; i++)
- {
- if (j%i != 0)
- {
- p1 = j;
- }
- else
- {
- break;
- }
- }
- }
- cout<<p1<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement