Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,k,f;
  8.     f = 0;
  9.     cin >> n >> k;
  10.     for (int i=1; i<=n; i++)
  11.     {if (i%k == 0) {f++;}};
  12.     cout << f << endl;
  13.  
  14.     int s;
  15.     s = 0;
  16.     cin >> n;
  17.     for (int i=1;i<=n;i++)
  18.     {
  19.         if (i%2!=0) (s=s+i);
  20.     };
  21.     cout << s << endl;
  22.  
  23.     float a;
  24.     int c1,c2,c3;
  25.     c1=0;
  26.     c2=0;
  27.     c3=0;
  28.     for(int i=0; i<8; i++)
  29.     {
  30.         cin >> a;
  31.         if (a>0) c1++;
  32.         if (a<0) c2++;
  33.         if (a==0) c3++;
  34.     }
  35.     cout << c1 << endl;
  36.     cout << c2 << endl;
  37.     cout << c3 << endl;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement