-
-
Save javascripter/344974 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int x, y; | |
for (x = 1; x <= 5; x++) { | |
for (y = 1; y <= 5; y++) { | |
printf("%d x %d = %d\n", x, y, x * y); | |
} | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
int i; | |
int j;/* int i, jでまとめて宣言できる。この場合x,yとしたほうがわかりやすいかも */ | |
for(i=1; i<=5; i=i+1){ /* i=i+1はi++か++iに */ | |
for(j=1; j<=5; j=j+1){/* j=j+1も同様にj++か++j */ | |
/* printfのインデントが足りない */ | |
printf("%d x %d = %d\n",i,j,(i*j));/* (i*j)は単にi*jで良い */ | |
} | |
return 0; /* インデントがおかしいと場所まちがえる、returnはmainの最後 */ | |
} /* ブレースの位置おかしいよ! */ | |
/* ここでreturn 0;する */ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment