[Solved] C compilation errors [closed]


You may need to declare f as float, I am not getting any error in the following:

#include <stdio.h>

int main(void)
{
    int i,n;
    float f = 1;
    printf("Enter value of n:");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        if(i%3==0)
            f=f/i;
        else
            f=f*i;
    }
    printf("%f\n", f);
    return 0;
}

4

solved C compilation errors [closed]