코드업 기초 100제
1045 : [기초-산술연산] 정수 2개 입력받아 자동 계산하기
develop.me.z
2020. 12. 23. 13:49
내 답
#include <iostream>
using namespace std;
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/b);
return 0;
}
모범답안
#include <stdio.h>
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);
printf("%.2lf", (double)a/b);
return 0;
}