#include <stdio.h>

int main() 

{
    int i,n,sum=0;
    printf("Enter the number:\n");
    scanf("%d",&n);
    for(i=0;i<=n;i++)
        {
            if(i%2==0)
            {
               sum=sum+i;
            }
        }
    printf("%d",sum);
    
    return 0;
}




#include <stdio.h>

int main() 

{
    int i,n,sum=0;
    printf("Enter the number:\n");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        {
            if(i%2==1)
            {
               sum=sum+i;
            }
        }
    printf("%d",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: