➽ Program:-

#include<stdio.h>

int main()

{

    int i, number, even = 0, odd = 0;

    printf("Enter the Number: ");

    scanf("%d", &number);

   

    for(i = 1; i <= number; i++)

    {

        if(i % 2 == 0)

            even += i;

        else

            odd += i;

    }

   

    printf("Sum of all Even Numbers = %d\n", even);

    printf("Sum of all Odd Numbers = %d", odd);

    return 0;

}

➽ Output:-

Enter the Number: 50
Sum of all Even Numbers = 650
Sum of all Odd Numbers = 625