What is the wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the wrong?

#include <iostream> #include<match> using namespace std; int main() { int n,sum,i,y; cout<<"Enter n "; Cin>>n; for(i=0;i<=n;i+=z) { y=pow(i,3); sum+=y; } cout<<"the sum of squre no"=<<sum; getch(); }

20th Oct 2021, 10:53 AM
Mohamed Elamin
Mohamed Elamin - avatar
1 Answer
+ 4
This is working. I mentioned the error fixes through comments #include <iostream> #include<cmath> //here using namespace std; int main() { int n,sum=0,i,y; //here cout<<"Enter n "; cin>>n; //here for(i=0;i<=n;i+=2) //here { y=pow(i,2); //here sum+=y; } cout<<"the sum of squre no="<<sum;//here }
20th Oct 2021, 11:11 AM
Rishi
Rishi - avatar