Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<iomanip>
- #include <fstream>
- #define A max 99
- //-------------------------------------------------------------
- using namespace std;
- const char VF = 99;
- const char CDfv[]="Duomenys.txt";
- const char CRfv[]="Rezultatai.txt";
- //-------------------------------------------------------------
- int main(){
- int n, i, dbd;
- int A[VF];
- ifstream fd(CDfv);
- fd >> n;
- ofstream fr (CRfv);
- for (int i=0; i<n; i++){
- fd >> A[i];
- }
- max=[0];
- for (int i=1; i<n; i++){
- if (A[i]>max)
- max=A[i];
- }
- for (int i=1; i<=max; i++){
- sum=0;
- for(int j=0; j<n; j++){
- if(A[j]%i==0)
- sum=sum+1;
- }
- }
- if(sum==n)
- dbd=i;
- fd.close();
- fr.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment