Aleksandr_Grigoryev

HW 4b

Nov 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     const int n=5;
  6.     int a[n]={1,5,1,7,2},i,min,s;
  7.     min=a[0];
  8.     s=0;
  9.     for (i=0;i<n;i++)
  10.     {
  11.         if (a[i]<min)
  12.         {
  13.             min=a[i];
  14.         }
  15.         if (a[i] == min)
  16.             s++;
  17.     }
  18.     for (i=0;i<n;i++)
  19.     cout<<a[i]<<' ';
  20.     cout<<"s="<<s<<endl;
  21.     system("pause");
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment