Sunday, November 1, 2020

C program to find even numbers, sum, average in between 1 to 10 using for loop and if....else statement

 #include <stdio.h>

int main()

{

    int i,sum,count=0;

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

    {

        if(i%2==0)

        {

        printf("%d\n",i);

        sum+=i;

        count++;

        }

    }

    printf("Sum=%d\n",sum);

    printf("Average=%d",sum/count);

    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...