In: Computer Science
Design the logic for a program that allows a user to enter 20 numbers, then displays them in the reverse order of entry.
Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the numeric average of the numbers entered.
The program is C++. I need a Pseudocode
Code (first one)
#include<iostream>
using namespace std;
int main()
{
int a[20]; // create array of 20 elements
for(int i=0;i<20;i++)
{
cin>>a[i];
}
cout<<"values in reversed order\n";
for(int i=19;i>=0;i--)
{
cout<<a[i]<<" ";
}
return 0;
}
Pseudocode (first one)
Code(second one)
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a[20]; // create array of 20 elements
for(int i=0;i<20;i++)
{
cin>>a[i];
}
int sum=0;
for(int i=0;i<20;i++)
{
sum=sum+a[i];
}
cout<<"number and thier difference with avg\n";
int avg=sum/20;
for(int i=0;i<20;i++)
{
cout<<a[i]<<" "<<abs(a[i]-avg)<<"\n";
}
return 0;
}
Pseudocode
Terminal Work(first one)
Terminal Work(second one)
.