Google

«   2024/05   »
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
BLOG Total Visitors
Today Hit, Yesterday Hit
BLOG main image


visitor stats
[Schizo!, 2007. 11. 10. 21:18, study/programming]

1번

#include < stdio.h>

void main()
{
 int nMonth, nCheck;

 printf("달을 입력하세요 : ");
 scanf("%d", &nMonth);

 nCheck = nMonth > 0 ? (nMonth <= 12 ? ((nMonth < 7) ? 0 : 1) : -1 ) : -1;
 

 if(nCheck == -1)
  printf("달의 범위가 아닙니다.\n");
 else if(nCheck == 0)
  printf("상반기\n");
 else
  printf("하반기\n");
}


2번

#include < stdio.h>

void main()
{
 int nNumber, nCheck;

 printf("정수를 입력하세요 : ");
 scanf("%d", &nNumber);

 nCheck = nNumber % 2 == 0 ? 0 : 1;
 
 if(nCheck == 0)
  printf("짝수입니다.\n");
 else
  printf("홀수입니다.\n");
}

3번

#include < stdio.h>

void main()
{
 int a, b, c, max;

 printf("정수를 입력하세요 : ");
 scanf("%d %d %d", &a, &b, &c);

 max = (a>b) ? ((a>c) ? a : c) : ((b>c) ? b : c);
 
 printf("가장 큰 수는 %d입니다.\n", max);
}

5번

#include < stdio.h>

void main()
{
 int a, b[32]={0,}, i=31, temp;

 printf("정수를 입력하세요 : ");
 scanf("%d", &a);

 while(a!=0)
 {
  temp = a % 2;
  a /= 2;
  b[i] = temp;
  i--;  
 }
 
 for(i=0; i<32; i++)
  printf("%d", b[i]);

 printf("\n");
}

'study > programming' 카테고리의 다른 글

c  (0) 2007.11.12
07.11.04 정보처리산업기사 합격수기  (0) 2007.11.11
반복문 9월 17일  (0) 2007.09.17
tcp/ip  (0) 2007.09.13
dd  (0) 2007.09.13


본인의 아이피 주소 확인과 위치 추적