Computer Science, asked by hudanaeem20, 1 year ago

Your program will asks you to enter any numbers. It will continue to ask for a number until you choose no. there are no limitation on how many numbers you can enter. After you choose no, the program will identify how many numbers have you entered, how many even numbers have you entered, how many odd numbers have you entered, the sum of all the numbers you have entered, and the average of the numbers you have entered.Identify the output, input and process for the above problems using CoPS Method

program in c language

Answers

Answered by sailorking
1

Answer:

#include<stdio.h>

void main ( )

{

        int a, b, c, d;

         c = 1 ;

          b = 0 ;

       while ( c < = 100 )

       {

                printf ( " Enter a number " ) ;

                scanf ( " % d " , & a) ;

                if ( a % 2 = = 0)

                   {

                           b + + ;

                   }

                  else

                   {

                           d + + ;

                     }              

              }

              printf ( " Your even count = %d, odd count = %d", b,d ) ;

}

Explanation:

Here a single variable is taking input and checking whether it is even or odd, and accordingly the counting variables of even and odd are incremented. The total process is being iterated for 100 times, using a while loop.

Similar questions