Hello, someone could help me with this exercise it's about Reading numbers: Write a program that reads a group of 10 numbers from the
user and place them inside a float type array. Once the numbers are
stored in the array, the program must calculate the average of these numbers and must
print the result on the screen. Use only pointer notation. For this one
exercise, it is forbidden to access the indexes by means of square brackets ([]).
1
Expert's answer
2017-12-04T14:18:07-0500
#include<iostream> using namespace std;
int main(int argc, char* argv[]) { float arr[10],avrg=0; cout<<"Enter 10 numbers:"<<endl; for(int i=0;i<10;i++) { cin>>*(arr+i); avrg+=*(arr+i); } avrg/=10; cout<<"Average of numbers is "<<avrg<<endl;
Comments
Leave a comment