81.c

来自「包含对应于实例1~实例190的程序源代码xxx.c和可执行文件xxx.exe」· C语言 代码 · 共 29 行

C
29
字号
#include<stdio.h>
void main()
{
    long int a,n=0;
    clrscr();
    puts("***********************************************************");
    puts("*      >>      This program is to verify       <<         *");   
    puts("*      >>     odd number's characteristic.     <<         *");
    puts("* That is square of an odd number larger than 1000 minus  *");
    puts("* 1 can be divided exactly by 8.                          *");
    puts("* For example, 2001^2-1=4004000=500500*8.                 *");
    puts("***********************************************************");
    while(n<1001)
    {
    	printf(" >> Please input the range you want to verify: ");
    	scanf("%ld",&n);
    }
    puts(" >> Now start to verify:");
    for(a=1001;a<=n;a+=2)
    {
        printf("%ld:",a);       /*输出奇数本身*/
        printf("(%ld*%ld-1)/8",a,a);      /*输出(奇数的平方减1)/8*/
        printf("=%ld",(a*a-1)/8);        /*输出被8除后的商*/
        printf("+%ld\n",(a*a-1)%8);      /*输出被8除后的余数*/
    }
    puts("\n Press any key to quit...");
    getch();
}

⌨️ 快捷键说明

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