Expected primary expression

I getting expected primary expression before '=' in line 24 . And after a lot of efforts, I realized that may I am half blind. Please tell me, what primary expression are they talking about?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  //question 2

#include<iostream>
#include<math.h>
using namespace std;
void AddSeries(int);

int main(){


cout<<"Please enter the value of 'n'...\n";
int n;

cin>>n;

 AddSeries(n);
return 0;
}


void AddSeries(int n){

int sum=0, Ssum=0;
for(int a=1; a< = n; a++){// error at this line


     for(int b = 1; b<=a; b++)
        Ssum+=b;

    sum+=pow(Ssum, a);

}

cout<<"So the required ans is "<<sum;

}
It must be a <= n not a< = n ! It's a little gap between < and = !!!
Last edited on
Thanks, that worked :D
Topic archived. No new replies allowed.