Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
20171117_TARTAGLIA
#include <stdio.h> #include <stdlib.h> void imprimirTrianguloTartaglia(unsigned short n); void imprimeFilaTartaglia(unsigned short f); 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); imprimirTrianguloTartaglia(n); return 0; } void imprimirTrianguloTartaglia(unsigned short n) { unsigned short fila; for(fila = 0 ; fila <= n ; fila++) { imprimeFilaTartaglia(fila); printf("\n"); } return; } void imprimeFilaTartaglia(unsigned short f) { unsigned short i; for(i = 0 ; i <= f ; i++) { printf("%8lu", binomio(f, i)); } } 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
CPTTRN_1
piesa perdida
factorial using function in c
18BCE2182 ASSESS_2 Q3
22nd HW Switchv0.1
structure1
swap two numbers without arithematic operators
hello
Ppp
vetor mult