035. 조건 순환문 이해하기 1(while~continue~break)035. 조건 순환문 이해하기 1(while~continue~break)

Posted at 2010. 11. 13. 23:30 | Posted in Computer/초보자를 위한 C 언어 300제
#include <stdio.h>

main()
{
	int i = 1;
	int hap = 0;

	while( i <= 10 )
	{
		hap = hap + i;
		i++;
	}

	printf( "hap = %d",hap );
}
//

034. 조건 선택문 이해하기(switch~case~default)034. 조건 선택문 이해하기(switch~case~default)

Posted at 2010. 11. 13. 23:29 | Posted in Computer/초보자를 위한 C 언어 300제
#include <stdio.h>

main()
{
	int i = 5;

	switch( i )
	{
	case 1:
		printf( "i는 1입니다." );
		break;
	case 2:
		printf( "i는 2입니다." );
		break;
	default:
		printf( "i는 %d입니다.",i );
		break;
	}
}
//

033. 중첩 순환문 이해하기(for~continue~break)033. 중첩 순환문 이해하기(for~continue~break)

Posted at 2010. 11. 13. 23:27 | Posted in Computer/초보자를 위한 C 언어 300제
#include <stdio.h>

main()
{
	int i;
	int j;

	for( i = 1; i <= 9; i++ )
	{
		for( j = 1; j <= 9; j++ )
		{
			printf( "%d * %d = %2d\n",i,j,i*j );
		}
	}
}
//