Question: Convert this C program to Risc V assembly code, then test to see if it works. #include int main() { int arr[] = { 2,

Convert this C program to Risc V assembly code, then test to see if it works.

#include

int main()

{

int arr[] = { 2, 6, 8, -4, -5, 5, -11 };

int n = 7;

int pos_count = 0;

int neg_count = 0;

int i;

for (i = 0; i

if (arr[i] > 0)

pos_count+= arr[i];

else

neg_count += arr[i];

}

printf("pos_count = %d", pos_count);

printf("neg_count = %d", neg_count);

return 0;

}

Convert this C program to Risc V assembly code, then test to

\#include int main() \{ int arr[]={2,6,8,4,5,5,11[]}; int n=7; int pos_count =0; int neg_count =0; int i; for (i =0;i0) \[ \text { pos_count+= } \operatorname{arr}[i] ; \] else preg_count +=arr[i]; printf("neg_count =%d, neg_count)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!