RE-ENGINEERING

Page: 1 2 3 4 5 6 7 8 9


#include "stdio.h"
#include " conio.h "
void main()
{
int i,n,a[20],r,*a1,*a2;
clrscr();
printf("Enter No.of Elements: ");
scanf("%d",&n);
printf("Enter the elements:");
for(i=0;i < n;i++)
scanf("%d",&a[i]);
a1=&a[0];
a2=&r;
{
asm
{
asm mov si,a1
asm mov di,a2
asm mov cx,n
asm mov ax,00h
}
here: asm
{
asm mov bx, [si]
asm add ax,bx
asm add si,2
asm loop here
asm mov[di],ax
}
}
for (i=0;i < n;i++)
printf("%d\n0",a[i]);
printf("Sum=%d ",r);
getch();
}

OUTPUT
Enter No.of Elements: 10
Enter the elements: 2 4 6 8 10 12 14 15 16 18
Sum=105