Created
January 3, 2014 07:31
-
-
Save marcoscastro/8234266 to your computer and use it in GitHub Desktop.
Implementação do triângulo de Floyd em C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// imprime triângulo de floyd até linha N | |
void mostrar_triangulo(int N) | |
{ | |
if(N < 1) | |
return; | |
int i = 0, qte = 1, num = 1; | |
while(i < N) | |
{ | |
int j; | |
for(j = 0; j < qte; j++) | |
{ | |
printf("%d\t", num); | |
num++; | |
} | |
printf("\n"); | |
qte++; | |
i++; | |
} | |
} | |
int main(int argc, char *argv[]) | |
{ | |
mostrar_triangulo(10); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment