Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;

}

image text in transcribed

\#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions