Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
2017_1117_TARTAGLIA
#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; }
run
|
edit
|
history
|
help
0
Area
ajr
Day Of The Programmer
e
problemapi2
Vowel Assignment
Double data type.c
Collatz(3k+1)
Bitex
formatting_input_and_output