Platinum Partner

Pascal Triangle Plotter XD


//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com

#include 
#include 

#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;
}

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}