#include <stdio.h>

int main() {
    int N, sum = 0;
    printf("Enter the value of N: ");
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        // Check if the number is odd
        if (i % 2 != 0) {
            // If it's odd, add it to the sum
            sum += i;
        }
    }
    printf("The sum of all odd numbers between 1 and %d is: %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: