First n natural number || for loop || C programming
In this, we are going to see for loop, the program is based on for loop which basically, prints even number from 1 to N with the help of the C Programming language. 



#include <stdio.h>
int main()
{
    int i, n;
    printf("Enter an integral number:-\n");
    scanf("%d", &n);
    printf("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;
}

//......Coded by YASH ALAPURIA

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post