Addition of array elements, C/C++ Programming

Assignment Help:

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);                       

}

 


Related Discussions:- Addition of array elements

Program, write a c++ program which finds minimum of three numbers

write a c++ program which finds minimum of three numbers

Car rental payment system, payment system, in c++ only..just use the printf...

payment system, in c++ only..just use the printf or scanf.please

Restart, how to create program in c that will system restart

how to create program in c that will system restart

C program for rotation, Normal 0 false false false EN-U...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Array, Assigning value to individual elements in array

Assigning value to individual elements in array

Super ASCII stringchecker, In the Byteland country a string "s" is said to ...

In the Byteland country a string "s" is said to super ascii string if and only if count of each charecter in the string is equal to its ascci value in the byteland country ascii co

Looping, Write a programme to display the patern.. A A B A C B A B C...

Write a programme to display the patern.. A A B A C B A B C A B A A

What is the difference between javascript and php, What is the difference b...

What is the difference between JavaScript and PHP? The difference lies with the execution of languages. PHP is server side scripting language, which means that it cannot intera

Determine the capacitor voltage by c program, Write a program to determine ...

Write a program to determine V c for a given value of time (t)   #include stdio.h #include math.h void main() {      char prompt;   float vs,cr,t,vc;   /* input time */

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