#include <stdio.h>
int main()
{
int dan = 2;
int num = 1;
while(dan < 10)
{
while(num < 10)
{
printf("%d * %d = %d \n" , dan , num , dan*num);
num++;
}
dan++;
}
return 0;
}
=========================================================
#include <stdio.h>
int main()
{
int dan = 2;
int num = 0;
while(dan < 10)
{
num = 1;
while(num < 10)
{
printf("%d * %d = %d \n" , dan , num , dan*num);
num++;
}
dan++;
}
return 0;
}
이 두개의 차이가 뭐길래 위에껀 출력이 안되고 아래껀 정상적으로 구구단이 출력이되는거임?
어짜피 num에 1이 저장되있는건데 뭔차이이임? 이해가안감 진심;
num 1로 안해주면 다음루프때 바로 빠지지
왜 다음루프에 바로 빠지는거야?
아! 처음에만 해놓으면 두번째 while 다돌고 num이 10으로 고정되있으니 다음단이 출력이 안되는거구나
이제 이해했당 ㅎㅎ