printf("ho_tari\n");

printOne2Ten 본문

C

printOne2Ten

호타리 2023. 9. 1. 12:27
#include <stdio.h>



int main(void)

{

	//printf("1\n");

	//printf("2\n");

	//printf("3\n");

	//...

	//printf("10\n");

	

	int i;

	i = 1;

	while (i <= 10)   // 1 ~ 10

	{

		printf("%d\n", i);

		++i;    // i = i + 1;

	}

	

	return 0;

}

 

#include <stdio.h>



int main(void)

{

	/*

	int i;

	i = 1;

	while (i <= 10)   // 1 ~ 10

	{

		printf("%d\n", i);

		++i;    // i = i + 1;

	}

	*/

	

	/*

	int i;

	i = 1;

	for ( ; i <= 10; )   // 1 ~ 10

	{

		printf("%d\n", i);

		++i;    // i = i + 1;

	}

	*/

	

	for (int i = 1; i <= 10; ++i)

	{

		printf("%d\n", i);

	}

	

	return 0;

}

 

<compile 결과>

'C' 카테고리의 다른 글

pyramid  (0) 2023.09.01
procScore  (0) 2023.09.01
printA2Z(가로)  (0) 2023.09.01
printA2Z(세로)  (0) 2023.09.01
exponent practice  (0) 2023.09.01