Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- void main() {
- int n, i, factorial = 1;
- printf("Inserati un numar intreg: \n");
- scanf_s("%d", &n);
- if (n == 0) {
- printf("0! = 1");
- }
- else if (n >= 1) {
- for (i = 1; i <= n; i++) {
- factorial = factorial * i;
- }
- printf("%d!= %d", n, factorial);
- }
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement