Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int a, b;
- int main()
- {
- cout << "podaj liczbe: " << endl;
- cin >> a;
- if (a < 0) cout << "nie mozna policzyc silni liczby ujemnej";
- else if (a == 0) cout << "0! = 1";
- else {
- b = 1;
- for (int i = 1; i <= a; i++) b *= i;
- cout << b << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment