Problem 26: Even Numbers

Print the EVEN numbers between 1 to 100 using loop.

 

3,401 total views, 3 views today

Comments

comments

3 thoughts on “Problem 26: Even Numbers”

  1. #include
    int main()
    {
    int i, n;
    printf(“Print all even numbers till: “);
    scanf(“%d”, &n);
    printf(“All even numbers from 1 to %d are: \n”, n);
    for(i=1; i<=n; i++)
    {
    if(i%2==0)
    {
    printf("%d\n", i);
    }
    }

    return 0;
    }

Leave a Reply

Your email address will not be published.