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

📄 sumsqres.c

📁 c版本的
💻 C
字号:
                                          /* Chapter 5 - Program 1 */
int sum; /* This is a global variable */

main()
{
int index;

   header();        /* This calls the function named header */
   for (index = 1;index <= 7;index++)
     square(index); /* This calls the square function */
   ending();        /* This calls the ending function */
}

header()        /* This is the function named header */
{
   sum = 0;     /* Initialize the variable "sum" */
   printf("This is the header for the square program\n\n");
}

square(number)   /* This is the square function */
int number;
{
int numsq;

   numsq = number * number;  /* This produces the square */
   sum += numsq;
   printf("The square of %d is %d\n",number,numsq);
}

ending()   /* This is the ending function */
{
   printf("\nThe sum of the squares is %d\n",sum);
}

⌨️ 快捷键说明

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