- 1

It is not working. Why???

#include<iostream> using namespace std; int main() { int n; cout<<"enter a no."; cin>> n; int i=0; int sum=0; for(;n*2>i;i+2) { sum=sum+i; } cout<<sum; return (0); }

8th May 2020, 5:17 PM
Luxmin SSR
Luxmin SSR - avatar
5 ответов
+ 3
i+2 should be i+=2
8th May 2020, 5:24 PM
Avinesh
Avinesh - avatar
+ 2
In for loop it should be i+=2
8th May 2020, 5:24 PM
Abhay
Abhay - avatar
0
Enter i + = 2 ....bro
10th May 2020, 2:42 PM
Naveed
Naveed - avatar
- 1
Thanks
9th May 2020, 4:06 AM
Luxmin SSR
Luxmin SSR - avatar