⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pascal.c

📁 Many C samples. It is a good sample for students to learn C language.
💻 C
字号:
#include <stdio.h>
#include <conio.h>
#define N 15

void main()
{
  int i, j, tgpascal[N], tmp[N];

  clrscr();
  tgpascal[0] = 1;
  for (i=1; i<N; i++)
    tgpascal[i] = 0;
  for (i=0; i<N; i++)
  {
     for (j=0; j<=i; j++)
       tmp[j] = tgpascal[j];
     printf("\n%5d", tmp[0]);
     for (j=1; j<=i; j++)
     {
       tmp[j] += tgpascal[j-1];
       printf("%5d", tmp[j]);
     }
     for (j=0; j<=i; j++)
       tgpascal[j] = tmp[j];
  }
  getch();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -