U E D R , A S I H C RSS

Yggdrasil/파스칼의삼각형

... ...
tempj+1=sumj+1; 모르...
tempj=sumj;면 는데...
를 막 바 ...
...
~cpp 
#include<iostream.h>
int main()
{
	int i, j; // for 문 돌리는데  
	int select; //  
	int temp[10]={1,};
	cout<<" \n";
	do{
		cout<<"몇  ?\n";
		cin>>select;
		if(select>10)
			cout<<"는 10.\n";
	}while(select>10);
	int sum[10]={0,};
    	cout<<"\n";

	for(i=1;i<select+1;i++){
		for(j=0;j<i;j++){
			if(j==0 || j==i-1)
				sum[j]=1;
			else
				sum[j]=temp[j-1]+temp[j];
			cout<<sum[j]<<" ";
			temp[j+1]=sum[j+1];
		}
		cout<<"\n";}
	return 0;
}


  • . . ? ...
10 는 부.
면 for 문. -
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:29
Processing time 0.0092 sec