0

can someone please tell me where am I wrong?

script: #include <iostream> using namespace std; int main() { int a1; int d; int n; int an; cout << "what is a1?" << endl; cin >> a1; cout << "what is d?" << endl; cin >> d; cout << "what is n?" << endl; cin >> n; cout << "what is an?" << endl; cin >> an; if (a1 =999){ int x = an - d * ( n - 1 ) ; cout << "a1 = " << x <<endl; } if (d = 999){ int x = ( an -a1 ) / ( n - 1 ) ; cout << "d = " << x <<endl; } if (n= 999){ int x = ( an - a1 + d ) / d ; cout << "n = " << x<<endl; } if (an =999) { int x = a1 + ( n - 1 ) * d ; cout << "an = " << x << endl; } return 0; }

14th Sep 2016, 2:15 PM
David Attar
David Attar - avatar
1 Resposta
+ 1
You are using = (assignment operator) instead of == (equality testing operator) for your if conditions.
14th Sep 2016, 2:18 PM
Zen
Zen - avatar