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

Assignment Help:

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

 

 


Related Discussions:- C program for even & odd no in any matrices

Define constructors-extract and insert operators, For your class to work pr...

For your class to work properly, you'll need to define appropriate constructors, extract and insert operators, and of course arithmetic operators. (If you wanted to use it as a gen

Star, Write a program that finds the minimum total number of shelves, inclu...

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

What does odbc do in context with php, What does ODBC do in context with PH...

What does ODBC do in context with PHP? PHP supports many databases such as dBase, Microsoft SQL Server, Oracle, etc. however, it also supports databases such as filePro, FrontB

Decompression of files compressed with LZW, The files are meteorological ra...

The files are meteorological radar data whose decompression is badly needed for relative study. Please contact Kathy Lee (Email: ; Cell phone: 0086 15701799056) or Mr. Zhu (Email:

Explain structures, Structures A structure is a derived data type. It i...

Structures A structure is a derived data type. It is a combination of logically related data items. Unlike arrays, which are a collection of such as data types, structures can

Lexicographic permutation, Given an integer n and a permutation of numbers ...

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

Arrays, what is an array?

what is an array?

C program to swap two numbers using reference arguments, Aim: To implement...

Aim: To implement a program to swap two numbers using reference arguments. Code: void swap(int *a, int *b) {             int temp;             temp=*a;

What is the use of pear in php, What is the use of PEAR in php? PEAR is...

What is the use of PEAR in php? PEAR is termed as PHP Extension and Application Repository. It provides structured library to PHP users and also gives provision for package mai

Area , Write a program to find the area under the curve y = f(x) between x ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd