I NEED A LC-3 MACHINE LANGUAGE PROGRAM NOT A JAVA PROGRAM.Write a LC-3 machine l
ID: 3737217 • Letter: I
Question
I NEED A LC-3 MACHINE LANGUAGE PROGRAM NOT A JAVA PROGRAM.Write a LC-3 machine language program that counts the number of positive and negative numbers in a sequence of numbers that are stored beginning at address x3200. The last number in the sequence is 0. The program’s output must be the following 2 lines:
Count of negative numbers: n
Count of positive numbers: m
Where n and m are the number of negative and positive numbers respectively. You can assume that n and m are always less than 10. Make sure that your program is clearly commented
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
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.