Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. int newton1(int n, int k)
  5. {
  6. int wynik=1;
  7. int wynik2=1;
  8. int wynik3;
  9. int m=1;
  10. if(k==0 || n==0)
  11. return 0;
  12. else
  13. {
  14. n-1;
  15. for(int i=1;i<=k;i++)
  16. wynik=wynik*(n - i + 1 )/i;
  17. k-1;
  18. for(int i=1;i<=k;i++)
  19. wynik2=wynik2*(n - i + 1 )/i;
  20. }
  21. return wynik3=wynik+wynik2;
  22. }
  23. int main()
  24. {
  25. int n,k;
  26. ifstream plik;
  27. plik.open("plik.txt");
  28. plik>>n>>k;
  29. cout << "\n\n\t inczej (n po k)= "<<newton1(n,k);
  30. cout << "Hello world!" << endl;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement