I've still been bashing my head to no avail. This is the best I've come up with and it doesn't work. Here's the entire code. Feel free to correct me wherever you like. Being new with all this, I have no damn idea what I am doing and where it's all going wrong. I'd honestly be grateful for the guidance. The other idea was to use if(i%2!=0), but that went nowhere.
Code:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i,j,k=1,n;
float s,p,q;
printf("Insert n=");
scanf("%d",&n);
s=0; p=0;q=0;
for (i=1; i<=n;i+=2){
for (j=1;j<=n;j+=2){
k*=i;
}
q+=k;
p+=i;
}
s+=q/p;
printf("%.2f",s);
return 0;
}
All I know is that for number 3, the result given should be 8.00, not 1.80