Advertisement
LabiinfaCibGyti

laba5.13.1

Dec 11th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int _tmain(int argc, _TCHAR* argv[])
  7. {
  8. int i, n;
  9. float x, k1=0,k2=0,k3=0;
  10. setlocale(0, "rus");
  11. cout<<"Введите кол-во чисел"<<endl;
  12. cin>>n;
  13. for (i = 1; i <= n; i++)
  14. {
  15. cout << "Введите число" << endl;
  16. cin >> x;
  17. if (x<0)
  18. k1++;
  19. if (x==0)
  20. k2++;
  21. if (x>0)
  22. k3++;
  23. }
  24. cout<<"Кол-во отрицательных чисел= "<<k1<<"\tКол-во нулевых чисел= "<<k2<<"\tКол-во положительных чисел= "<<k3<<endl;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement