038. 문자열 이해하기038. 문자열 이해하기

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

#define ASCII_BEGIN 0
#define ASCII_END 255

main()
{
	int i;

	for( i = ASCII_BEGIN; i <= ASCII_END; i++ )
	{
		printf( "ASCII 코드 (%3d), 문자 = '%c'\n", i, i );
	}
}
//

037. 무조건 분기문 이해하기037. 무조건 분기문 이해하기

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

main()
{
	int i;
	int j;

	for( i = 1; i <= 100; i++ )
	{
		for( j = 1; j <= 99; j++ )
		{
			printf("%d * %d = %2d\n",i,j, i*j );
			if( i == 9 && j == 9 ) goto ku_ku_end;
		}
	}

ku_ku_end:;
}
//

036. 조건 순환문 이해하기 2(do~while~continue~break)036. 조건 순환문 이해하기 2(do~while~continue~break)

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

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

	do 
	{
		hap = hap + i;
		i++;				// i는 1,2,3,4,5,6,7,8,9,10,11까지 증가
	} while( i <= 10 );		// i가 10보다 작거나 같은 동안 반복, 11이면 순환 탈출

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