Saturday, July 13, 2019

Sum of Array

Sum Of  (N) Number in Array

sum of (n) number in array


#include<stdio.h>
#include<conio.h>

void main()
{
int a[2][2],b[2][2],c[2][2],i,j;
clrscr();

for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("\nThe Value is a[%d][%d]",i,j,a[i][j]);
scanf("%d",&a[i][j]);
printf("\nThe Value is b[%d][%d]",i,j,b[i][j]);
scanf("%d",&b[i][j]);
}
  }
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("\nThe Value of a[%d][%d] is :-  %d",i,j,a[i][j]);
printf("\nThe Value of b[%d][%d] is :-  %d",i,j,b[i][j]);
}
   printf("\n");
}
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("\n TheTotal is c[%d][%d] is :- %d",i,j,c[i][j]);

}
printf("\n");
}

getch();

}

Output:


sum of (n) number



EmoticonEmoticon