Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

error array with parameters and function

$
0
0
need to write array with 50 elements, use each content of array and
output of them square and squareroot and need to print.
this code is for square but my code have problems do not give me output, can you please help?

#include <iostream>
    #include <math.h>
    using namespace std;
    int square(int,int);
    main()
    {
          int size=50;              //Array size
          int array[size];          //Declaring array
          int sum=0;                
          for(int i=0;i<size;i++)   //Loop which inputs arrays data and
                                    //Calculates its sum
          {
                sum={[i]*[i]}
                cout<<sum<<endl;
          }



    }
    int square (int sum,int size)
    {
        return sum;
    }

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>