곱셈문제

· C언어
처음에 이 문제를 만나서 당황했다. 비트 연산인가..? 3*100 + 8 * 10 + 5 * 1 이렇게 나눠서 하는건가? 등등 고민하다가 결국 간단하게 연산자로 풀 수 있다는 것을 깨달았다. 정답은 가까이에.. #include int main(void) { int a, b; int one, ten, hundred; scanf("%d%d", &a, &b); hundred = b / 100; ten = (b % 100) / 10; one = (b % 100) % 10; printf("%d\n", a * one); printf("%d\n", a * ten); printf("%d\n", a * hundred); printf("%d\n", a * b); return 0; } int형 변수 one, ten, hun..
jayoon
'곱셈문제' 태그의 글 목록