New course! Every coder should learn Generative AI!
Try a free lesson0
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(); }
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
}