Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. main()
  8. {
  9. int i=1, n,a ;
  10. double liczba, x, suma=0;
  11.  
  12. cout << "podaj liczbe wyrazow ";
  13. cin >> n;
  14.  
  15.  
  16. while(i<=n)
  17. {
  18. cout << "liczba " << i << " to ";
  19. cin >> x;
  20. i++;
  21. if(fmod(x,2)!=0)
  22. {
  23. suma+=x;
  24. }
  25. }
  26.  
  27.  
  28. cout << "Suma: " << suma << "\n";
  29.  
  30.  
  31.  
  32. system("pause");
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement