Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.  
  10. srand(time(NULL));
  11. int w, x, y;
  12. long long silniaX = 1, silniaY = 1;
  13.  
  14. cout<<"Podaj y: ";
  15. cin>>y;
  16. if(y>0)
  17. {
  18. x = rand() % (10-5+1)+5;
  19.  
  20. for(int i=1;i<x;i++)
  21. {
  22. silniaX *= i;
  23. }
  24.  
  25. for(int i=1;i<y;i++)
  26. {
  27. silniaY *= i;
  28. }
  29.  
  30. w = (silniaX+silniaY) / (1+2+3+4+x+y);
  31.  
  32. cout<<"x = "<<x<<endl;
  33. cout<<"w = "<<w<<endl;
  34. }
  35.  
  36.  
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement