C program for even & odd no in any matrices , C/C++ Programming

C Program for EVEN & ODD NO IN ANY MATRICES

#include stdio.h>

#include conio.h>

void main()

{

          int a[100][100];

          int i=0,j=0,r,c,even=0,odd=0;

          clrscr();

          for(i=0;i<100;i++)

          {

                   for(j=0;j<100;j++)

                             a[i][j]=0;

          }

          i=0;    j=0;

          printf("\nENTER THE NO OF ROWS: ");

          scanf("%d",&r);

          printf("\nENTER THE NO OF COLS: ");

          scanf("%d",&c);

          for(i=0;i

          {

                   for(j=0;j

                   {

                             printf("\nENTER THE ELEMENTS: ");

                             scanf("%d",&a[i][j]);

                   }

          }

          for(i=0;i

          {

                   for(j=0;j

                   {

                             printf("%d ",a[i][j]);

                             if(a[i][j]%2==0)

                                      even++;

                             else

                                      odd++;

                   }

                   printf("\n");

          }

          printf("\nTHE EVEN NO ARE %d",even);

          printf("\nTHE  ODD NO ARE %d",odd);

 

          getch();

}

OUTPUT :

ENTER THE NO OF ROWS : 2

ENTER THE NO OF COLS  : 2

ENTER THE ELEMENTS : 1

ENTER THE ELEMENTS : 5

ENTER THE ELEMENTS : 3

ENTER THE ELEMENTS : 4

1          5

3          4

THE EVEN NO ARE: 1

THE   ODD NO ARE: 3

 

 

Posted Date: 9/10/2012 7:45:51 AM | Location : United States







Related Discussions:- C program for even & odd no in any matrices , Assignment Help, Ask Question on C program for even & odd no in any matrices , Get Answer, Expert's Help, C program for even & odd no in any matrices Discussions

Write discussion on C program for even & odd no in any matrices
Your posts are moderated
Related Questions
Hello, Do you have any idea for programming project to simulate a network attack (threat) mechanism or a defense mechanism. Can I get some suggestions for this. Please include th

Return by reference: The return value of the function must be an address variable.  In following program the function returns the value of x or y and their types are declare

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t



Question : (a) How does a structure differ from an array? (b) Describe how a structure differs from a union? (c) Declare a union called ‘clothes' which consists of the

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

Project Description: I have software written with VB that i helped design, but now the original author died,(Neil Tromp), and the software ended up in the hands of someone else!

Need Cron Job Parsing JSON from API, Inserting in to DB Project Description: The Project is to prepare a Cron Job with an adjustable interval in seconds and milli seconds. Cr

What is the specialty in sizeof() operator