Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
B_141209_TrianguloTartalia
//Title of this code #include <stdio.h> void imprimirTrianguloTartaglia(short nfilas); void imprimirFilaTartaglia(short fila); long binomioNewton(short a, short b); long factorial(short n); int main(void) { short N; printf("Dime cuántas líneas del triángulo quieres ..."); scanf(" %hd", &N); imprimirTrianguloTartaglia(N); return 0; } void imprimirTrianguloTartaglia(short nfilas) { short i; for(i = 0 ; i <= nfilas; i++) { imprimirFilaTartaglia(i); printf("\n"); } return; } void imprimirFilaTartaglia(short fila) { short i; for(i = 0 ; i <= fila ; i++) { printf("%5ld", binomioNewton(fila, i)); } return; } long binomioNewton(short a, short b) { long fa, fb, fa_b; fa = factorial(a); fb = factorial(b); fa_b = factorial(a - b); return fa / (fb * fa_b); } long factorial(short n) { long F = 1; while(n) F *= n--; return F; }
run
|
edit
|
history
|
help
0
C_141204_ConcatenarCadenas
Project 3 Part 1 v1.3
Is const really const? Yes
TAREA M4 - LOTERIA
Quiz4
14th Feb Programming Project v.01
Leap year check
PointerFunct
Text to ASCII (top)
Timestamp microsecond for C