i tried to create a program that would get the sum of the squares but i couldn't get the right output. Could u help me debug? and tell which part of my codes where wrong.PLEASE!
:S
#include<iostream.h>
#include<conio.h>
#include<math.h>
int x,num;
int f(int);
main ()
{
clrscr();
cout<<"Enter a number: ";
cin>>num;
cout<<f(num);
getch ();
return 0;
}
int f(int s)
{
for(x=1;x<=s;x++)
{
int ans2;
int y;
int ans[10];
ans[y]=pow(x,2);
ans2=ans[y]+ans[y];
cout<<ans2;
y++;
}
return 0;
}