C Program to Print sum of each row individually in 2D Array.

  Print sum of each row individually in 2D Array.

    Matrix [5][6]

#include<stdio.h>
#include<conio.h>
 void main ( )
 {
  int arr[5][6], i , j , s=0;
   clrscr( );
    for( i=0;  i<5;  i=i+1 )
    {
      for ( j=0;  j<6;  j=j+1 )
      {
       printf("Enter data ");
       scanf("%d",& arr[i][j]);
        }
    printf("\n");
  }
for( i=0;  i<5;  i=i+1 )
{
  s=0;
 for( j=0;  j<6;  j=j+1 )
 {
   s=s+arr[i][j];
 }
printf("Sum=%d\n",s);
}
getch( );
}

Post a Comment

0 Comments