#include<stdio.h>
#include<conio.h>
#include<string.h>
int n1,n2,daul ,dau2; int s1[21],s2[21];
char son[21],sobn[21]; void nhan();
void nhan(void)
{
int nho,bac,tich,i,j;
int tong[50]={0};
int tg[50]={0};
int nmax,ntg;
bac=1;
tich=1;
nho=0;
nmax=0;
//hoan dot phan tu mang
for (j=0;j<=n2;j++)
tg[n2-j]=s2[j];
for (j=0;j<=n2;j++)
s2[j]=tg[j];
for (j=0;j<=nl;j+=)
tg[nl-j]=s1[j];
for (j=0;j<=n1;j++)
s1[j]=tg[j];
//Nhan hai so
for (j=0;j<=n2;j++)
{
bac=j;
for (i=0;i<=n1;i++)
{
tich =s1[i]*s2[j]+nho;
for(i=ntg+1;i>=0;i ) printf("-");
printf(”\n”);
gotoxy(50-ntg,wherey());
if(dau1*dau2<0)
{
gotoxy(50-nmax),wherey());
printf("-");
for(i=nmax;i>=0;i ) printf("%d",tong[i]);
}
e1se
{
gotoxy(49 —nmax,wherey()); printf(”—");
for(i=ninax;i>=0;i ) printf("%d",tong[i]);
}
}
void main()
{
int i,dem,1en1,1en2; char ch;
tt:
clrscr();
printf("\n CHUONG TRINH NHAP VA TINH HAI SO NGUYEN LON");
printf("\n\n *************************");
i=0;
dem=0;
printf(”\n\nSo Thu 1: ");fflush(stdin);
do
{
ch=getch();
if(ch>='0'&&ch<='9'&&i<20)
dem++;
sobn[i]=ch;
printf("%c",ch);
s2[i]=sobn[i]-48;
if(s2[0]==0) continue;
i++;
}
len2=strlen(sobn);
n2=i-1;
if((ch=='-')&&(!dau2))
{
if(dem==0)
dau2==1;
dem++;
printf("%c",ch);
}
whi1e(ch!= l3);
printf(”\n\nMo ta phep nhan tay!\n");
printf("\n\nTich hai so la: \n");
if(dau1==—1)
{
gotoxy(50—lenl ,wherey());
printf(”-");
printf(”%s",son);
}
else
printf("%50s",son);
printf(”\n”);
if(len1>=len2)
{
rintf("%c",ch);
goto tt;
}
if(ch=='k'||ch=='K')
{
printf("%c",ch);
break;
}
whi1e(ch!=-1);
getch();
}