일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- SASS
- react
- netlify variables
- 이미지 좌표 추출
- S3
- rwdImageMaps
- nodejs
- 어셈블리어
- GeoJSON object too complex/large
- ogr2ogr
- 설치완료안됨
- CSS
- 김골라
- Error:error:0308010C:digital envelope routines::unsupported
- Sequelize Error: Dialect needs to be explicitly supplied as of v4.0.0
- ERR_PNPM_NO_GLOBAL_BIN_DIR
- EC2
- AWS
- can't getting credentials
- C언어
- credential error
- AWS CodeBuild
- 이미지 맵
- node
- AWS CodePipeline
- NODE_VERSION
- 반응형 페이지 좌표 변환
- Unable to find the global bin directory
- expo
- aws ec2
- Today
- Total
목록Programming/C언어 백준 풀이 (26)
ImFe's study

#include int main() { int yoon; scanf("%d", &yoon); if(yoon%4==0&&yoon%100!=0) printf("1\n"); else if(yoon%400==0) printf("1\n"); else printf("0"); return 0; }

#include int main() { int score; scanf("%d", &score); if(score>=90) printf("A"); else if(score>=80) printf("B"); else if(score>=70) printf("C"); else if(score>=60) printf("D"); else printf("F"); return 0; } 비교연산자 >= if랑 else는 단 한번만 사용 할 수있지만, else if는 여러번 사용 가능하다. else if 앞에 else가 오면 컴파일 에러가 발생한다.

#include int main() { int a,b=0; scanf("%d %d", &a, &b); if(a>b) printf(">"); if(a

원하는 출력값을 그대로 입력해준다. #include int main() { int a; int b; int c; scanf("%d %d %d", &a, &b, &c); printf("%d\n", (a+b)%c); printf("%d\n", ((a%c)+(b%c))%c); printf("%d\n", (a*b)%c); printf("%d\n", ((a%c)*(b%c))%c); return 0; }

문제) 123*456이라고 가정하면 123*6, 123*5, 123*4의 값과 123*456의 값이 필요하다. 123*일의 자리, 123*십의 자리, 123*백의자리 순으로 계산해 주어야 한다. #include int main() { int a,b=0; scanf("%d %d", &a, &b); printf("%d\n", a*(b%10)); printf("%d\n", a*((b/10)%10)); printf("%d\n", a*(b/100)); printf("%d", a*b); return 0; } 나머지 연산(modulo)과 나누기 연산을 잘 활용하면 해당 자릿수만 이용 할 수 있다(정수형이여서 소숫점은 잘린다)
-문제 두 자연수 A와 B가 주어진다. 이때, A+B, A-B, A*B, A/B(몫), A%B(나머지)를 출력하는 프로그램을 작성하시오. #include int main() { int a, b; scanf("%d %d", &a, &b); printf("%d\n", a+b); printf("%d\n", a-b); printf("%d\n", a*b); printf("%d\n", a/b); printf("%d\n", a%b); return 0; } 시키는 대로 잘 따라하자 scanf에서 한 번에 정수 두 개를 입력받을 수 있다.

#include int main() { double a, b = 0; scanf("%lf", &a); scanf("%lf", &b); printf("%.9lf", a/b); return 0; } 10^-9까지 허용한다 했으니 double형을 사용해야 한다. printf("%.9lf", a/b); 는 a/b값을 소숫점 아래 9자리까지 표시한다는 의미이다