Sunday, November 1, 2020

C program of even numbers in between 1-10

First Method:

#include <stdio.h>

int main()

{

    int i;

    for(i=2;i<=10;i+=2)

    {

        printf("%d",i);

    }

    return 0;

}


Second Method:
#include <stdio.h>
int main()
{
    int i,n;
    printf("Enter a number:");
    scanf("%d",&n);
    for(i=2;i<=n;i+=2)
    {
        printf("%d",i);
    }
    return 0;
}

No comments:

Post a Comment

Everyone Is Fighting a Battle You Can't See ❤️ | A Simple Reminder to Be Kind

 Hi, namaste Krishna. So today we will be talking about that everyone is going through something in their life. Be it you, be it your friend...