6.3 程序改錯題

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x=1,find=0;
    while (!find)
    {
        if(x%2==1&&x%3==2&&x%5==4&&x%6==5&&x%7==0)
        {
            printf("x=%d\n",x);
            find=1;
        }
        x++;
    }

    return 0;
}

這裏寫圖片描述
總結:while的後面沒有“;”。 在c語言程序中“等於”的符號是“==”。“x++”的位置應如上述位置。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章