Addition of array elements, C/C++ Programming

Addition of array elements:

#define rows 3

#define cols 3

void main()

{

                int i=0,j=0,sum=0;

                int arr[rows][cols];

                for (i=0; i<=rows-1; i++)

                                for(j=0;j<=cols-1;j++)

                                {

                                                printf("Enter elements (%d,%d)\n",(i+1),(j+1));

 

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

                                }

                for (i=0; i<=rows-1; i++)

                {

                                printf("\t");       

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

                                                {

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

                                                }

                                                printf("\n");

                }

                printf("\n Sum of matrix\n");

                for(i=0;i<=rows-1;i++)

                                for(j=0;j<=cols-1;j++)

                                {

 

                                                sum=sum+arr[i][j];

                                }

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

}

 

Posted Date: 9/29/2012 7:22:30 AM | Location : United States







Related Discussions:- Addition of array elements, Assignment Help, Ask Question on Addition of array elements, Get Answer, Expert's Help, Addition of array elements Discussions

Write discussion on Addition of array elements
Your posts are moderated
Related Questions
I need whatsapp software in my website Project Description: i need whatsapp software in my website same this whatsapp if anyone can make to me this in my website Skills

Write a main program that uses these system calls to echo the typed characters. The pseudo code will look something like: void traphandler ()  {    if (R0 == 0) { // read sys

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

Convert a COV/CPE (Micosoft Fax Cover Page) file to a TIF image file Project Description: I would like a small API written that will take a COV/CPE file and replaced the corr

Example for external storage class - computer programming? extern double sin (double); In a function prototype, for the sin() function its function definition ~ we can write

I need website Product section search box coding section fix Project Description: On our products section in the search box it only searches the name and title of our product

Find out the largest torque: A flat belt is taken in use to transmit torque from pulley A to pulley B as shown in figure given below. The radius of each pulley is 50mm and co

Step 1 Define the start of the program    It should be noted that within C all commands should end in a semi-colon. For most of your programs the definition of a program header as

Develop Diablo 2 LOD 1.13d Dupe Method for Closed Battle.net This hack is for diablo 2 lord of destruction The program must work on all realms, all cores, all ladders (4x rea

Constructor and Destructor function with derived classes If there are constructors included in the base class and the derived class, the compiler automatically calls both of th