#include <stdio.h>

int main() {
    FILE *fptr;
    fptr=fopen("Odd.txt","w");

    int n;
    printf("enter n : ");
    scanf("%d",&n);

    for(int i=1; i<=n;i++) {
        if(i%2 !=0) {
            fprintf(fptr,"%d\n",i);
        }
    }
    fclose(fptr);
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: