1 / 4
Jun 2020

#include<stdio.h>
struct pair{
int a,b,c;
};
void main()
{int i,n;
struct pair e[1000];
scanf("%d",&n);
if(n<=1000)
{
for(i=0;i<n;i++)
{
{
scanf("%ld%ld",&e[i].a,&e[i].b);
if((e[i].a<10000)&&(e[i].b<10000))
e[i].c=(e[i].a)*(e[i].b);
else break;
}
}
{
for(i=0;i<n;i++)
printf("%ld\n",e[i].c);
}
}
}

  • created

    Jun '20
  • last reply

    Jun '20
  • 3

    replies

  • 544

    views

  • 2

    users

  • 1

    link

Remember this test case I gave for your previous post on MUL?

1
123456789012345678901234567890 123456789012345678901234567890

Do you think the ints a and b will be able to hold these numbers? Will c be able to hold their product?

The integers to be multiplied can be up 10000 decimal digits long, not up to 10000.

please provide the solution I mean 10,000 digits is a very large number I nevers solved for such a massive number

Big numbers are the whole point of this problem. Did you really think a Classic SPOJ problem would be to multiply two small numbers?

You have two choices. Choose a language (or library) that can handle large numbers, such as Python or C# or C++ Boost, or write a multiplication function yourself.