asmodeus94

odADoB

Sep 4th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. main(){
  7. int a=0,b=0,dod=0,uje=0,zBylF=0;
  8. cout<<"Podaj a: ";cin >> a;
  9. cout<<"\nPodaj b: ";cin >> b;
  10. if(a>b) swap(a,b);
  11. cout<<"Liczby z przedzialu "<<a<<" - "<<b<<": ";
  12. for(int x=a;x<=b;x++){
  13.         if(x==0) zBylF=1;
  14.         if(x>0) dod++;
  15.         if(0>x) uje++;
  16.         cout<<x;
  17.         if(x!=b) cout<<", ";
  18. }
  19. cout<<"\nLiczb dodatnich: "<<dod;
  20. cout<<"\nLiczb ujemnych: "<<uje;
  21. if(zBylF==0) cout<<"\nZero wystapilo";else cout<<"\nZero nie wystapilo\n";
  22. system("pause");
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment