top of page

소스 코드 제출

공개·회원 50명

20250823


/*

#include <stdio.h>

int main()

{

int x, y, z;

scanf("%d:%d:%d", &x, &y, &z);

printf("%d", y);

return 0;

}

*/

/**


정수 int %d ( 약 -21억 ~ 약 +21억)

long long int %lld

실수

문자



int a, b;

scanf("%d %d", &a, &b);

printf("%d", a+b); // %lld , (long long int) a + b


point!!

a+b가 int범위를 넘을 수 있따!!!! -> overflow 오버플로


강제형변환 (casting)


정수/정수 -> 정수 몫

ex)


10 / 3 -> 3

10.0 / 3 -> 3.33333333


(float) a / b -> 실수 결과


**/



/*

#include <stdio.h>

int main()

{

int a, b, c;

scanf("%d %d %d", &a, &b, &c);

printf("%d\n", a+b+c);

printf("%.1f", (float) (a+b+c)/3);

return 0;

}

*/


/**

비교연산자

> < >= <= == !=


printf("%d", a>b); // 1 true or 0 false


논리연산자

not and or (x)

! && ||


printf("%d", !(a>b) && b>10);



삼항연산자

python -> 참일때의값 if 조건식 else 거짓일때의값

c -> 조건식 ? 참일때의값 : 거짓일때의값


둘 중 큰 수 출력

printf("%d", a>b ? a : b );


조건문


if (조건식)

{

명령;

}

else if(조건식)

{

명령;

}

else

{

명령;

}


+ switch- case 문법

if (a==10 || a==20)

{

명령1;

}

else if(a==30)

{

명령2;

}

else

{

명령3;

}



--->


switch(a)

{

case 10 :

case 20 : 명령1; break;

case 30 : 명령2; break;

default : 명령3; break;

}


*/





//#include <stdio.h>

//int main()

//{

// int a, b;

// scanf("%d %d", &a, &b);

// if (a>b)

// {

// printf("%d", a-b);

// }

// else

// {

// printf("%d", b-a);

// }

//

// return 0;

//}




//#include <stdio.h>

//int main()

//{

// int x;

// scanf("%d", &x);

// if ((30<=x && x<=40) || (60<=x && x<=70))

// {

// printf("win");

// }

// else

// {

// printf("lose");

// }

// return 0;

//

//}




//#include <stdio.h>

//int main()

//{

// int x;

// scanf("%d", &x);

// if (x==1 || x==3 || x==5 || x==7)

// {

// printf("oh my god");

// }

// else

// {

// printf("enjoy");

// }

// return 0;

//

//}







//#include <stdio.h>

//int main()

//{

// int x, y, z;

// scanf("%d %d %d", &x, &y, &z);

// if ((x-y+z)%10==0)

// {

// printf("대박");

// }

// else

// {

// printf("그럭저럭");

// }

// return 0;

//

//}




//#include <stdio.h>

//int main()

//{

// int x;

// scanf("%d", &x);

// if (x%400==0)

// {

// printf("Leap");

// }

// else if(x%4==0 && x%100!=0)

// {

// printf("Leap");

// }

// else

// {

// printf("Normal");

// }

// return 0;

//

//}







//#include <stdio.h>

//int main()

//{

// int x, y;

// scanf("%d %d", &x, &y);

// if (y<30)

// {

// if (x==0)

// {

// printf("23 %d", y+30);

// }

// else

// {

// printf("%d %d", x-1, y+30);

// }

// }

// else

// {

// printf("%d %d", x, y-30);

// }

// return 0;

//

//}



//#include <stdio.h>

//int main()

//{

// int x;

// scanf("%d", &x);

// if (x/10==1)

// {

// printf("%dth", x);

// }

// else if(x%10==1)

// {

// printf("%dst", x);

// }

// else if(x%10==2)

// {

// printf("%dnd", x);

// }

// else if(x%10==3)

// {

// printf("%drd", x);

// }

// else

// {

// printf("%dth", x);

// }

// return 0;

//}


//#include <stdio.h>

//int main()

//{

// int x;

// scanf("%d", &x);

// switch(x/10)

// {

// case 1 : printf("%dth", x); break;

// default : switch(x%10)

// {

// case 1 : printf("%dst", x); break;

// case 2 : printf("%dnd", x); break;

// case 3 : printf("%drd", x); break;

// default : printf("%dth", x);

// }

// }

//}






//#include <stdio.h>

//int main()

//{

// int a, b, c;

// scanf("%d %d %d", &a, &b, &c);

// if (a+b>c && b+c>a && c+a>b)

// {

// if (a==b && a==c)

// {

// printf("정삼각형");

// }

// else if(a==b || b==c || c==a)

// {

// printf("이등변삼각형");

// }

// else if (a*a+b*b==c*c || b*b+c*c==a*a || c*c+a*a==b*b)

// {

// printf("직각삼각형");

// }

// else

// {

// printf("삼각형");

// }

// }

// else

// {

// printf("삼각형아님");

// }

// return 0;

//}



//#include <stdio.h>

//int main()

//{

// int a;

// scanf("%d", &a);

// if (a>=90)

// {

// printf("A");

// }

// else if (a>=70)

// {

// printf("B");

// }

// else if (a>=40)

// {

// printf("C");

// }

// else

// {

// printf("D");

// }

//

// return 0;

//}



//#include <stdio.h>

//int main()

//{

// char a;

// scanf("%c", &a);

// switch(a)

// {

// case 65 : printf("best!!!"); break;

// case 66 : printf("good!!"); break;

// case 67 : printf("run!"); break;

// case 68 : printf("slowly~"); break;

// default : printf("what?"); break;

// }

// return 0;

//}



//#include <stdio.h>

//int main()

//{

// int a;

// scanf("%d", &a);

// switch(a)

// {

// case 1 :

// case 2 :

// case 12 : printf("winter"); break;

// case 3 :

// case 4 :

// case 5 : printf("spring"); break;

// case 6 :

// case 7 :

// case 8 : printf("summer"); break;

// default : printf("fall"); break;

// }

// return 0;

//}





//#include <stdio.h>

//int main()

//{

// int a, b, c;

// scanf("%d %d", &a, &b);

// scanf("%d", &c);

// a=(a+(b+c)/60)%24;

// b=(b+c)%60;

// printf("%d %d", a, b);

// return 0;

//}


3회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page