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

#include #include #include #include #include class Employee { private: char *Name; //Set them as pointers... int IdNumber; char *Department; char *Position; public: voi

Explain the Command Line Parameters? The Command line arguments are parameters supplied to a program from the operating system. These arguments are parameters accepted to main

Addition of array elements: #define rows 3 #define cols 3 void main() {                 int i=0,j=0,sum=0;                 int arr[rows][cols];

how many bytes required to char

In this assignment the main has been written for you in the file phone_book_main.cpp. You will also notice that a class called Person has been declared as having several prototypes

Explain the working of strcmp and strcat Function? strcmp() : This function is meant to use to compare two strings. The strcmp() function acknowledge two strings as argument

When I develop a destructor, do I require to explicitly call the destructors for my member objects?

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

flow chart for push operation in stack