0 Replies - 191 Views - Last Post: 12 May 2014 - 04:42 AM

#1 kovalchuk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-May 14

Transfer a code from C on an Assambler

Posted 12 May 2014 - 04:42 AM

Don't judge me strictly, I only started studying an assambler!
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
void main()
{int *mas;
int a,i,n;
int temp;
system ("chcp 1251");
system ("cls");
printf ("Введите количество элементов:");
scanf ("%d",&n);
mas=(int*) malloc(n*sizeof(int));
for(i=0;i<n;i++)
{printf("mas[%d]= ",i);
scanf("%d",&mas[i]);
}
for(i=0;i<n/2;i++)
{temp = mas[i];
mas[i] = mas[n-i-1];
mas[n-i-1] = temp;}
 
for(i=0;i<n;i++)
printf("%d ",mas[i]);
 
getchar(); getchar();
}



#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
void main()
{int *mas;
int a,i,n;
int temp;
printf ("elements: ");
scanf ("%d",&n);
mas=(int*) malloc(n*sizeof(int));
for(i=0;i<n;i++)
{printf("mas[%d]= ",i);
scanf("%d",&mas[i]);
}
for(i=0;i<n/2;i++)
{temp = mas[i];
mas[i] = mas[n-i-1];
mas[n-i-1] = temp;}

for(i=0;i<n;i++)
printf("%d ",mas[i]);

getchar(); getchar();
}

First code is wrong, sorry about that

Is This A Good Question/Topic? 0
  • +

Page 1 of 1