C Program to Addition of All Elements in Matrix | Summation of Elements of matrix in c
#include
#include
void main()
{
int i,j,a[10][10],sum,m,n;
/* m - Number of rows
n - Number of Columns */
printf("\n Enter the number of Rows : ");
scanf ("%d",&m);
printf("\n Enter the number of Columns : ");
scanf ("%d",&n);
/* Accept the Elements in m x n Matrix */
for(i=0;i<m;i++)
for(j=0;j<n;j++ )
{
printf(" \n Enter the Element a[%d][%d] : ", i , j);
scanf("%d",&a[i][j]);
}
/* Addition of all Elements */
sum = 0;
for(i=0;i<m;i++ )
for(j=0;j<n;j++ )
{
sum = sum + a[i][j];
}
/* Print out the Result */
printf("\nThe Addition of All Elements in the Matrix : %d",sum);
getch();
}
Enter the number of Rows : 2
Enter the number of Columns : 2
Enter the Element a[0][0] : 1
Enter the Element a[0][1] : 1
Enter the Element a[1][0] : 1
Enter the Element a[1][1] : 1
The Addition of All Elements in the Matrix : 4
Related Links :
History Of C..
In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.
My 1st Program...
#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}
Next Step...
#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");
printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");
getch ();
}
No comments:
Post a Comment