[ create a new paste ] login | about

Link: http://codepad.org/LnEieQhE    [ raw code | output | fork ]

C++, pasted on Mar 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;
 
int main()
{
    int n;
    long giaiThua = 1;
    cout << "Nhap so n: ";
    cin >> n;
    for(int i = 1; i <= n; i++) {
        giaiThua = giaiThua * i;
    }
    cout << "Giai thua cua " << n << " la " << giaiThua << endl;
    return 0;
}


Output:
1
Nhap so n: Giai thua cua 0 la 1


Create a new paste based on this one


Comments: