Facebook
From Andra, 2 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 185
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("atestat.in");
  5. ofstream fout("atestat.out");
  6. int main()
  7. {
  8.     long long int d,nou=1,x;
  9.     int ok;
  10.     while(fin>>x)
  11.     {
  12.         ok=1;
  13.         if(x<2)
  14.             ok=0;
  15.         for(d=2;d<x;d++)
  16.             if(x%d==0)
  17.                 ok=0;
  18.         if(ok==1)
  19.             nou=nou*x;
  20.     }
  21.     fout<<nou;
  22.     return 0;
  23. }