Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <ctime>
- using namespace std;
- int main() {
- srand(time(NULL));
- int a [101];
- for (int i = 0; i <= 100; i++)
- a[i] = i;
- int ch = 0;
- for (int i = 2;i<100;i++)
- {
- ch = 0;
- for(int j = 2;j<i;j++)
- {
- if (i%j==0)
- {
- ch++;
- }
- }
- if (ch==0)
- a[i] = 0;
- }
- int m = a[rand()%100];
- while (m==0)
- m = a[rand()%100];
- int n = a[rand()%100];
- while (n==0)
- n = a[rand()%100];
- cout << m << " " << n<< endl;
- while (m != n)
- {
- if (m > n)
- m = m - n;
- else
- n = n - m;
- }
- cout << "\nNaibol'shhiy obshiy delitel' = " <<m;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement