Can somebody tell me what is wrong with my code?
#include <stdio.h>
#include <math.h>
int main(void) {
int nSet=0;
int n1,n2;
int sum;
float hm,gm,avg,prod;
printf("Enter two integers: ");
scanf("%d%d",&n1,&n2);
for(;nSet<2;nSet++){
int sum=n1+n2;
float prod=n1*n2;
float hm=nSet/(1/n1+1/n2);
float gm=sqrt(n1+n2);
float avg=(n1+n2)/2;
}
printf("Sum: %d\n",sum);
printf("Product: %4.2f\n",prod);
printf("Average: %4.2f\n",avg);
printf("Geometric mean: %4.2f\n",gm);
printf("Harmonic mean: %4.2f\n",hm);
return 0;
}
originally by initializing in for loop i got 0 as every answer but atleast that printed something. I have to use loops to find the answers and i dont see why for loop would'nt work.