Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream> //Marcin Matliński
- using namespace std;
- int silnia(int n)
- {
- if (n == 0)return 1;
- return silnia(n - 1)*n;
- }
- double pierwiastki(double a,double b,double c)
- {
- double delta = b*b - 4.0*a*c;
- if (delta > 0.0)
- {
- delta = sqrt(delta);
- cout<< "x1 ="<< (-b + delta) / (2.0*a)<<endl;
- cout<< "x2 ="<< (-b - delta) / (2.0*a)<<endl;
- }
- else if (delta == 0.0)
- {
- cout << "x0 ="<< (- b / (2.0*a)) << endl;
- }
- else
- {
- cout << "Brak rozwiązań\n";
- }
- return 0;
- }
- int Fibonacci(int n)
- {
- if (n < 3)return 1;
- return (Fibonacci(n - 2) + Fibonacci(n - 1));
- }
- void napis()
- {
- char napis[100];
- for (i = 0; i < ; i++)
- {
- cout<<napis[0]<<napis[0]
- }
- }
- int main()
- {
- int n,x;
- double a,b,c;
- cout << "Podaj numer silni\n";
- cin >> n;
- cout << silnia(n) << endl;
- cout << "Podaj a,b,c"<<endl;
- cin >> a>> b>> c;
- cout << pierwiastki(a, b, c) << endl;
- cout << "Podaj numer ciągu Fibonacciego "<<endl;
- cin >> x;
- cout << Fibonacci(x) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement