x86 irvine library assembly code
Write a complete program that: 1. Prompt the user to enter 10 numbers. 2. save those numbers in a 32-bit integer array. 3. Print the array with the same order it was entered. 3. Calculate the sum of the numbers and display it. 4. Calculate the mean of the array and display it. 5. Rotate the members in the array forward one position for 9 times. so the last rotation will display the array in reversed order. 6. Print the array after each rotation. check the sample run. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Don't use any shift or rotate instructions which we have not covered yet. You need to use loops and any kind of addressing. All you work should be on the original array. Don't make a copy of the array at any time. Add comments to make your program easy to read. check the rubric before you submit.
#include<iostream>
#include<conio.h>
void
rotate(
int
arr[],
int
n)
{
int
x =
arr[n - 1], i;
for
(i =
n - 1; i > 0; i--)
arr[i] = arr[i -
1];
arr[0] =
x;
}
int main()
{ int a[10], i, sum=0, mean=0;
cout<<"Enter 10 Numbers"<<endl;
for(i=0;i<10;i++)
{cin>>a[i];
}
for(i=0;i<10;i++)
{cout<<a[i]<<endl;
}
for(i=0;i<10;i++)
{sum=sum+a[i];
}
cout<<"Sum of the numbers is"<<sum<<endl;
mean=(sum/10);
cout<<"Mean of the numbers is"<<mean<<endl;
int
n =
sizeof
(a) /
sizeof(a[0]);
for(i=0;i<10;i++)
{rotate(a, n);
for(i=0;i<10;i++)
{cout<<a[i];
}
}
}
Get Answers For Free
Most questions answered within 1 hours.