Advertisement
Dani_info

semnul majoritar a 5 nr intregi

Oct 19th, 2017
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, l=0, k=0, i;
  8. for(i=1; i<=5; i++)
  9. { cout<<"Introduceti numarul:";cin>>n;
  10. if(n<0)
  11. l=l+1;
  12. else
  13. k=k+1;
  14. }
  15.  
  16. if(l<k)
  17. cout<<"Semnul majoritar este:+";
  18. else
  19. cout<<"Semnul majoritar este:-";
  20.  
  21. return 0;
  22. }
Advertisement
RAW Paste Data Copied
Advertisement