Baekjun, question 2588

Asked 2 years ago, Updated 2 years ago, 44 views

Baekjun, I tried to solve question 2588 in a clueless way, but A and B came up with strange numbers I thought if I put 472, 385, I would get a multiplier, but I got a - or a 10 million digit number, so what's the reason? Is there anything wrong?

The problem is that if you are given three digits, such as 472,385, you will print 472X5472X8472X3472X385 over four lines! //

#include <stdio.h>
int main()
{


 int a,b,c,d,e,f,A,B;

A = 100*a+10*b+c;
B = 100*d+10*e+f;
scanf("%d,%d,%d",&a,&b,&c);
scanf("%d,%d,%d",&d,&e,&f);
printf("\n%d,%d,%d\n",A,B,A*B);
printf("%d\n%d\n%d\n%d",A*f+A*e,A*d,A*B);
return 0;
}...

code

2022-09-19 23:32

1 Answers

When you declare a variable, there will be a value of garbage. Before you assign values to A and B, you can use the scanf function to enter the values.


2022-09-19 23:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.