#include
#include
int main()
{
int n,q,f=0,s,m,d,a,i=-1,j=-1,a1[101],a2[101],sum[201],mul[101];
char ch;
clrscr();
printf("\nEnter frist number : ");
while((ch=getchar())!='\n')
{
switch(ch)
{
case '0':a=0;break;
case '1':a=1;break;
case '2':a=2;break;
case '3':a=3;break;
case '4':a=4;break;
case '5':a=5;break;
case '6':a=6;break;
case '7':a=7;break;
case '8':a=8;break;
case '9':a=9;break;
}
i++;
a1[i]=a;
}
printf("Enter second number : ");
while((ch=getchar())!='\n')
{
switch(ch)
{
case '0':a=0;break;
case '1':a=1;break;
case '2':a=2;break;
case '3':a=3;break;
case '4':a=4;break;
case '5':a=5;break;
case '6':a=6;break;
case '7':a=7;break;
case '8':a=8;break;
case '9':a=9;break;
}
j++;
a2[j]=a;
}
for(a=0;a<=200;a++)
sum[a]=0;
printf("\nMultiplication = ");
for(q=j;q>=0;q--)
{
m=101;d=0;
for(a=i;a>=0;a--)
{
m--;
n=((a1[a]*a2[q])+d)%10;
d=((a1[a]*a2[q])+d)/10;
mul[m]=n;
}
if(d>0)
{
m--;
mul[m]=d;
}
d=0;n=200-f;
for(a=100;a>=m;a--)
{
s=(sum[n]+mul[a]+d)%10;
d=(sum[n]+mul[a]+d)/10;
sum[n]=s;
n--;
}
f++;
if(d>0)
sum[n]=d;
}
n=199-i-j;
if(sum[n]==0)
n=200-i-j;
for(a=n;a<=200;a++)
printf("%d",sum[a]);
getch();
return 0;
}
0 comments:
Post a Comment