Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int SILNIA(int n)
- {
- int a,suma=1;
- for(int i=1;i<=n;i++)
- {
- suma=suma*i;
- }
- return suma;
- }
- int main()
- {
- int n;
- cout << "Funkcja silnia. Podaj liczbe: " << endl;
- cin >> n;
- if (n<1)
- {
- cout << "Zle podana liczba.";
- }
- else
- {
- cout << "Silnia wynosi: " << SILNIA(n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement