#include <stdio.h>

int main()
{
   int i,term,sum;
    printf("enter the number of terms:\n");
    scanf("%d",&term);
    for (i=1;i<term;i+=2)
        {
            printf("%d,",i);
            sum+=i;
         }
    printf("\n the sum is %d",sum);
}

Embed on website

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