C언어 콘서트 솔루션 2~6장 연습문제 + 프로그래밍 문제 풀이
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
해당 자료는 10페이지 까지만 미리보기를 제공합니다.
10페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

C언어 콘서트 솔루션 2~6장 연습문제 + 프로그래밍 문제 풀이에 대한 보고서 자료입니다.

목차

2장 EXERCISE
2장 PROGRAMMING


3장 EXERCISE
3장 PROGRAMMING

4장 EXERCISE
4장 PROGRAMMING

5장 EXERCISE
5장 PROGRAMMING

6장 EXERCISE
6장 PROGRAMMING

본문내용

tdio.h>
int main(void)
{
int price=0, money = 0, diff=0;
int ten_thousand_won=0, five_thousand_won=0, thousand_won=0;
printf("물건의 가격:");
scanf("%d", &price);
printf("고객에게 받은 돈:");
scanf("%d", &money);
if( price > money || money > 50000)
printf("다시 입력 하시오.\n");
else
{
diff = money - price;
ten_thousand_won = diff/10000;
five_thousand_won = (diff - ten_thousand_won*10000) / 5000;
thousand_won = (diff - ten_thousand_won*10000 - five_thousand_won*5000) / 1000;
printf("고객에게 내어줄 잔돈은 다음과 같습니다.\n");
printf("만 원권: %d 매 \n", ten_thousand_won);
printf("오천 원권: %d 매 \n", five_thousand_won);
printf("천 원권: %d 매 \n", thousand_won);
}
return 0;
}
CHAPTER 6
EXERCISE 문제
1.
(a) 1
2
3
4
(b) 10
9
8
7
6
최종 i의 값은 = 5
(c) 10
(d) ***************
2.
(a)
while(i<10)
{
printf("%d\n", I);
I++;
}
(b)
printf("i = %d\n", i); ->printf("i = %d\n", I)
3.
(a) for(i=0; i<10; i++)
(b)
i=0;
while(i<=20)
{
printf("%d\n", i);
i++;
}
4.
x=0, y=0
x=0, y=1
x=0, y=2
x=1, y=0
x=1, y=1
x=1, y=2
x=2, y=0
x=2, y=1
x=2, y=2
5. 0
1
2
3
6.
(a) x=0, sum=0으로 초기화 하고 x는 0에서 9까지 1씩 증가하면서 반복
(b) x=0, y=0으로 초기화 하고 조건식에 맞으면 반복하는데 x와 y를 동시에 1씩 증가
7.
(a)
int i;
for(i=1; i<10; i++)
printf("%d ", i);
(b)
int i;
for(i=1; i<10; i = i+2)
printf("%d ", i);
(c)
int i;
for(i=2; i<10; i = i+2)
printf("%d ", i);
(d)
int i;
for(i=9; i>=0; i = i-3)
printf("%d ", i);
8.
(a) i = 11
(b) i = 12
PROGRAMMING
1.
#include
int main(void)
{
int i;
for(i=1;i<100;i++)
if( (i%3)==0 )
printf("%d ", i);
return 0;
}
2.
#include
int main(void)
{
int i;
for(i=1;i<100;i++)
if( (i%3)==0 && (i%5)==0 )
printf("%d ", i);
return 0;
}
3.
#include
int main(void)
{
int i, ctemp;
printf("======================\n");
printf("화씨온도 섭씨온도\n");
printf("======================\n");
for(i=0;i<=100;i++)
{
ctemp = (i-32)*5.0/9.0;
printf("%d %d\n", i, ctemp);
}
return 0;
}
4.
#include
int main(void)
{
int year=0, sum=1000;
while(sum < 2000)
{
sum += sum * 0.07;
year++;
}
printf("year=%d\n", year);
return 0;
}
5.
#include
int main(void)
{
int i, k, n;
printf("숫자를 입력하시오: ");
scanf("%d",&n);
for(i = 1; i <=n; i++)
{
for(k = 1; k<= i; k++)
printf("%3d",k);
printf("\n");
}
return 0;
}
6.
#include
int main(void)
{
int min=2147483647;
int max=-2147483648;
while(1)
{
scanf("%d", &x);
if( x == 0 )
break;
if( x < min )
min = x;
if( x > max )
max = x;
}
printf("max=%d\n", max);
printf("min=%d\n", min);
return 0;
}
7.
#include
int main(void)
{
int i,k, value;
for(i=0;i<10;i++)
{
printf("데이터를 입력하시오:");
scanf("%d", &value);
printf("막대의 높이: %d\n", value);
for(k=0;k printf("*");
printf("\n");
}
return 0;
}
8.
#include
int main(void)
{
int a, b, c;
for(a=1;a<=100;a++)
for(b=1;b<=100;b++)
for(c=1;c<=100;c++)
{
if( (a*a+b*b) == c*c )
printf("%d %d %d\n", a, b, c);
}
return 0;
}
9.
생략
10.
#include
int main(void)
{
int x, y, prime;
for(x=2;x<=100;x++)
{
prime = 1;
for(y=2;y if( x % y == 0 )
prime = 0;
if( prime == 1 )
printf("%d\n", x);
}
return 0;
}

키워드

  • 가격3,000
  • 페이지수31페이지
  • 등록일2011.11.04
  • 저작시기2011.9
  • 파일형식한글(hwp)
  • 자료번호#712052
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니