Codeup.kr/C언어 기초 100제
[Code up 문제] 1045번 정수 2개 입력받아 자동 계산하기
Jongung
2021. 9. 6. 19:36
1. 정답 코드
#include <stdio.h>
int main() {
long long int a, b;
scanf("%lld %lld", &a, &b);
printf("%lld\n", a+b);
printf("%lld\n", a-b);
printf("%lld\n", a*b);
printf("%lld\n", a/b);
printf("%lld\n", a%b);
printf("%.2lf\n", (float)a / (float)b);
}
2. 코드 설명
이때까지 했던 연산자들을 사용하는 문제이다.
마지막에는 a, b 변수를 모두 float로 변환해사 문제 해결해주면 된다.