I need help understanding how to do this. Write an LC3 assembly language program
ID: 3740936 • Letter: I
Question
I need help understanding how to do this. Write an LC3 assembly language program that counts the number of positive and negative numbers in a sequence of numbers that are stored beginning at address x3300. The last number in the sequence is 0. Your program must start at address x3000.
The program’s output must be the following 2 lines:
Count of negative numbers: nnnnn
Count of positive numbers: mmmm
Where nnnnn and mmmm are the number of negative and positive numbers respectively. You can not assume that nnnn and mmmm are always less than 10
Explanation / Answer
LC-3 MACHINE LANGUAGE PROGRAM :
int a=0;
b=0,c;
for(i=-10;i<=0;i++)
{
if(i<0)
{
a=a+1;
}
c=i-(2*i);
if(c>0)
{
b=b+1;
}
}
printf("postive are "+a);
printf("negative are "+b)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.