codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include<stdio.h> #include<conio.h> int main() { int i, n; long S, P; S = 0; P = 1; i = 1; do { printf("\nNhap n: "); scanf("%d", &n); if(n < 1) { printf("\nN phai lon hon hoac bang 1. Xin nhap lai !"); } }while(n < 1); while(i <= n) { P = P * i; S = S + P; i++; } printf("\nTong la %d",S); getch(); return 0; }
Private
[
?
]
Run code
Submit