Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void reversePrint(int tab[], int howMany);
- void average(int tab[], int howMany);
- void maxFromArray(int tab[], int howMany);
- int main()
- {
- int howMany;
- cin>>howMany;
- int* tab= new int[howMany];
- for(int i=0; i<howMany; i++){
- cin>>tab[i];
- }
- reversePrint(tab,howMany);
- average(tab,howMany);
- delete tab;
- return 0;
- }
- void reversePrint(int tab[], int howMany){
- for(int i=howMany-1; i>=0; --i){
- cout<<tab[i]<<' ';
- }
- cout<<endl;
- }
- void average(int tab[], int howMany){
- int sum=0;
- double avr;
- for(int i=0; i<howMany; i++){
- sum+=tab[i];
- }
- avr=(double)sum/howMany;
- cout<<avr<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement