#include <stdio.h>
int main() 
{
    int i,n,sum=0;
    scanf("%d\n",&n);
    printf("nth Term=%d\n",n);
    printf("The odd numbers are=\n");
    for(i=1;i<=n;i++)
        {
            printf("%d\n",2*i-1);
            sum=sum+(2*i-1);
        }
    printf("The sum of the odd numbers upto %d terms=%d\n",n,sum);
    return 0;
}

Embed on website

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