Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
factorial
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//gcc 5.4.0 #include <stdio.h> int main(void){ int n; int f=1; int i; scanf("%d", &n); printf("f= %d\n", f); if (n==0) printf("Factorial of %d!:%d\n", n , f); else if (n<0) printf("Factorial of %d! %s\n", n, "is not possible"); else while (n >0){ //for (i=1; i<=n; i++) f *= n; --n; } printf("Factorial of n: %s/n", n , f); /* if (n<0) print no factorial else if (n==0) print fact = 1 else { while (){ filler } print factorial = f } */ return 0; }
gcc
3
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.15 sec, absolute running time: 0.6 sec, cpu time: 0.41 sec, memory peak: 4 Mb, absolute service time: 0,82 sec
edit mode
|
history
|
discussion
f= 1 Factorial of n: (null)/n