Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
20171117_TARTAGLIA
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
#include <stdio.h> #include <stdlib.h> void mostrarTrianguloTartaglia(unsigned short n); void imprimeFilaTartaglia(unsigned short n); unsigned long binomio(unsigned short a, unsigned short b); unsigned long factorial(unsigned short n); int main() { unsigned short n; printf("Numero de filas ... "); scanf(" %hu", &n); mostrarTrianguloTartaglia(n); return 0; } void mostrarTrianguloTartaglia(unsigned short n) { unsigned short f; for(f = 0 ; f <= n ; f++) { imprimeFilaTartaglia(f); printf("\n"); } return; } void imprimeFilaTartaglia(unsigned short n) { unsigned short m; for(m = 0 ; m <= n ; m++) { printf("%8lu", binomio(n, m)); } return; } unsigned long binomio(unsigned short a, unsigned short b) { return factorial(a) / (factorial(b) * factorial (a - b)); } unsigned long factorial(unsigned short n) { unsigned long f = 1; while(n) { f *= n--;} return f; }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
edit mode
|
history
|
discussion