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;
}

\#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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
