Guest User

Untitled

a guest
Jun 14th, 2013
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include<iomanip>
  3. #include <fstream>
  4. #define A max 99
  5. //-------------------------------------------------------------
  6. using namespace std;
  7. const char VF = 99;
  8. const char CDfv[]="Duomenys.txt";
  9. const char CRfv[]="Rezultatai.txt";
  10. //-------------------------------------------------------------
  11. int main(){
  12.     int n, i, dbd;
  13.     int A[VF];
  14.     ifstream fd(CDfv);
  15.     fd >> n;
  16.     ofstream fr (CRfv);
  17.     for (int i=0; i<n; i++){
  18.         fd >> A[i];
  19.  
  20. }
  21.         max=[0];
  22.         for (int i=1; i<n; i++){
  23.             if (A[i]>max)
  24.                 max=A[i];
  25.         }
  26.         for (int i=1; i<=max; i++){
  27.             sum=0;
  28.             for(int j=0; j<n; j++){
  29.                 if(A[j]%i==0)
  30.                     sum=sum+1;
  31.             }
  32.         }
  33.         if(sum==n)
  34.         dbd=i;
  35.  
  36.     fd.close();
  37.     fr.close();
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment