codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <stdio.h> #include <stdlib.h> int main() { int total_lineas = 10, nlinea = 1, nast = 0, nesp = 0; printf ("Piramide de asteriscos:\n"); printf ("Indique cuantos pisos desea que tenga la piramide (Maximo 40 pisos): "); scanf("%d", &total_lineas); while (nlinea <= total_lineas) { while (nesp < (nlinea - 1)) { printf(" "); nesp++; } while (nast < ((total_lineas * 2) - (nesp * 2) - 1)) { printf("*"); nast++; } nesp = 0; nast = 0; nlinea++; printf("\n"); } return 0; }
Private
[
?
]
Run code
Submit