Skip to content

Instantly share code, notes, and snippets.

@kolodziej
Created August 26, 2014 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolodziej/c604f709d9af6142e7b9 to your computer and use it in GitHub Desktop.
Save kolodziej/c604f709d9af6142e7b9 to your computer and use it in GitHub Desktop.
ld2: Obliczanie silni
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char ** argv)
{
int n = 0;
int silnia = 1;
cout << "\tObliczanie silni" << endl;
cout << "Podaj liczbe z jakiej mam policzyc silnie: ";
cin >> n;
for (int i = 1; i <= n; silnia *= i++);
cout << "n! = " << n << "! = " << silnia << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment