/*Addition of two arrays*/
#include<stdio.h> //header files
void main() //programme starts from here
{
int a[2][2],b[2][2],c[2][2],i,j; //initialize all variable
for(i=0;i<=1;i++) //for loop to store the value in two dimensional array
{
for(j=0;j<=1;j++)
{
printf("enter the values of a array= ");
scanf("%d",&a[i][j]); //store value in run time
}
}
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("enter the values of b array=");
scanf("%d",&b[i][j]);
}
}
for(i=0;i<=1;i++) //this loop is use for print the values of array
{
for(j=0;j<=1;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("\t\t%d",c[i][j]);
}
printf(" \n "); //jst to print new line it will show array in proper format
}
}
No comments:
Post a Comment