ValerianBenchea

+++CifreFrecv

Jan 30th, 2020
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream cin("cifrefrecv.in");
  5. ofstream cout("cfrefrecv.out");
  6. int f[10] ;
  7. int main()
  8. {
  9.     int a;
  10.     while(cin>>a)
  11.     {
  12.         if(a==2 || a==3 || a==5 || a==7)
  13.             f[a]++;
  14.     }
  15.     if(f[7])
  16.         cout<<7<<" "<<f[7];
  17.     else if(f[5])
  18.         cout<<5<<" "<<f[5];
  19.     else if(f[3])
  20.         cout<<3<<" "<<f[3];
  21.     else if(f[2])
  22.         cout<<2<<" "<<f[2];
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment