//+ Jonas Raoni Soares Silva //@ http://jsfromhell.com #include <stdio.h> #include <conio.h> #define MAX 16 int main () { int unsigned vetor[MAX], grau, i = 0, j, top, left; clrscr(); printf( "Dado o grau, printar o triangulo de pascal\n" ); while( grau > MAX && printf( "Digite um numero entre 0 e %d para o grau: ", MAX ) && scanf( "%u", &grau ) ); while( i++ < grau && !( j = 0 ) && printf( "\n" ) ) while( j < i && ( j == 0 && ( top = left = vetor[j] = 1 ) ? 1 : j > 0 && j < i-1 && ( top = vetor[j] ) && ( vetor[j] = left + top ) && ( left = top ) ? 1 : ( vetor[j] = 1 ) ) && printf( "%-5d", vetor[j] ) && ++j ); getch(); return 0; }
You need to create an account or log in to post comments to this site.