그럼 전 이만..
게시글 주소: https://orbi.kr/0001054850
1. 다음 프로그램을 작성하고, 결과 값을 분석해 본다.
#include <stdio.h>
main(){
int a = 3, b = 4, c;
float d, e;
c = a / b;
d = (float) a / b;
e = (float)(a / b);
printf("%f %f %f\n", (float)c, d, e);
}
/* c는 상수끼리의 계산이니까 0.000000이라는 수치가 나온다.
d는 a가 소수로 변했기 때문에 계산 후에 0.750000 이라는 수치로 나온다.
e는 이미 상수끼리 계산해서 0이 나온 결과값을 소수로 만든것이다. */
2.Write exactly the result printed when executing the following program.
#include <stdio.h>
int compute_sum(int n);
int main(void)
{ int n = 3, sum;
printf("%d\n", n);
sum= compute_sum(n);
printf("%d\n", n);
printf("%d\n", sum);
return 0;
}
int compute_sum(int n)
{ int sum=0;
printf("%d\n", ++n);
for (; n>0 ; --n){
sum += n;
printf("%d\n",sum);}
printf("%d\n", n++);
printf("%d\n", sum+1);
return sum;
}
/*
3
4
4
7
9
10
0
11
3
10
*/
3. Write exactly the result printed when executing the following program.[10]
#include <stdio.h>
int main()
{
int i, j;
for (i = 1 ; i <= 5 ; i++){
if (i == 3)
continue;
else
printf("%d\n",i);
}
for (j = 1 ; j <= 5 ; j++){
if (j == 3)
break;
else
printf("%d\n",j);
}
return 0;
}
4.Write a function definition all_equal() that takes three integers as inputs and returns the value 1 if they are all equal otherwise returns the value 0.[20]
int all_equal(int a, int b, int c)
{
/* write the codes that takes three integers as inputs and returns the value 1 if they are all equal otherwise returns the value 0.*/
}
5.Convert the following switch statement to an if-else statement.[15]
switch (op)
{
case 1:
printf("AAA\n");
break;
case 2:
case 3:
printf("BBCC\n");
break;
default:
printf("nothing\n");
break;
}
이런걸 하러....전 어서 가봐야겠습니다
아직 3문제나 남았군요 핳핳.
0 XDK (+0)
유익한 글을 읽었다면 작성자에게 XDK를 선물하세요.
3문제니깐 3수강
님 ㅋㅋㅋ제발 살려줘옄ㅋㅋㅋㅋ ...3수강이라니..끔찍
님도 공대??
네 공대에요..
대학가면 이런거해요 ??ㄷㄷ ㅠ
공대오면 이런걸합니닼ㅋ
리힛님 어디 대학가셨어요?ㅎㅎ 작년에 92동에서 봣는뎅 ㅋㅋ
연공왔어요.ㅋㅋ절 기억하는분이있다닝
이거보니까 갑자기 문과인데 공대들어간 제 친구가 걱정되네요..쩗...
전 어쩔수없는 문과체질인가봐요 보기만해도 막 짜증이ㅋㅋ 대단하심 저런걸 어떻게 배워요~_~
공대 공통과목으로 밀고있는....거라 컴공이아님에도 듣고있네요 ㅠㅜㅋ
근데 가야하는데..ㅋㅋㅋㅋ