SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | #include<iomanip> | |
| 3 | #include <fstream> | |
| 4 | - | #define A max 99 |
| 4 | + | //#define A max 99 |
| 5 | //------------------------------------------------------------- | |
| 6 | using namespace std; | |
| 7 | - | const char VF = 99; |
| 7 | + | const int VF = 99; |
| 8 | const char CDfv[]="Duomenys.txt"; | |
| 9 | const char CRfv[]="Rezultatai.txt"; | |
| 10 | //------------------------------------------------------------- | |
| 11 | int main(){
| |
| 12 | - | int n, i, dbd; |
| 12 | + | int n, dbd, max, sum, A[VF]; |
| 13 | - | int A[VF]; |
| 13 | + | |
| 14 | fd >> n; | |
| 15 | ofstream fr (CRfv); | |
| 16 | for (int i=0; i<n; i++){
| |
| 17 | fd >> A[i]; | |
| 18 | } | |
| 19 | - | |
| 19 | + | max=A[0]; |
| 20 | for (int i=1; i<n; i++){
| |
| 21 | - | max=[0]; |
| 21 | + | |
| 22 | max=A[i]; | |
| 23 | } | |
| 24 | for (int i=1; i<=max; i++){
| |
| 25 | sum=0; | |
| 26 | for(int j=0; j<n; j++){
| |
| 27 | if(A[j]%i==0) | |
| 28 | sum=sum+1; | |
| 29 | } | |
| 30 | if (sum==n) | |
| 31 | dbd=i; | |
| 32 | } | |
| 33 | - | if(sum==n) |
| 33 | + | |
| 34 | - | dbd=i; |
| 34 | + | |
| 35 | - | |
| 35 | + | |
| 36 | } |