Advertisement
Guest User

łakamakafą

a guest
Nov 29th, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. short PierwiastkiKwadratowe(double a, double b, double c, double &x1, double &x2)
  2. {
  3. short y;
  4. double delta;
  5. delta=(b*b)-(4*a*c);
  6. if(delta<0) y=0;
  7.  
  8. if(delta==0)
  9. {
  10. x1=(-b)/(2*a);
  11. y=1;
  12. }
  13.  
  14. if(delta>0)
  15. {
  16. x1=(-b-sqrt(delta))/(2*a);
  17. x2=(-b+sqrt(delta))/(2*a);
  18. if(x1>x2)
  19. {
  20. delta=x1;
  21. x1=x2;
  22. x2=delta;
  23. }
  24. y=2;
  25. }
  26. return y;
  27. }
  28.  
  29.  
  30. void Fibonacci(int tab[], int n)
  31. {
  32. int a=0, b=1;
  33.  
  34. if(n>0) tab[0]=a;
  35.  
  36. for(int i=1;i<=n;i++)
  37. {
  38. tab[i]=b;
  39. b+=a;
  40. a=b-a;
  41. }
  42. }
  43.  
  44.  
  45. int Licznik(bool x, int &y)
  46. {
  47. static int a=0;
  48. if (x==false) a++;
  49. if (x==true) y++;
  50. return a;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement