saving . . . saved Assingment -14 has been deleted. Assingment -14 has been hidden .
Assingment -14
Title
Question
//Two-dimensional arrays in C
#include <stdio.h>
int main()
{
   int i,j;
   int num1[3][4],num2[3][4];
   printf("Enter the elements of 3X4 array num1\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num1[i][j]);

   printf("Enter the elements of 3X4 array num2\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num2[i][j]);

   printf("The subtraction of num1 and num2 is\n");
   for(i=0; i<3; i++)
    {
      for(j=0; j<4; j++)
      printf("%3d ", (num1[i][j] - num2[i][j]));
      printf("\n");
    }
   return 0;
}


Naveen VP


C-and-Cpp Working-With-2D-Arrays 04-05 min 10-20 sec 06-12-21, 10:19 p.m. naveenpalanisamy142002@gmail.com

Answers:

Assignments are only for self-assessment. If you have any specific question related to this tutorial please post here.
10-01-22, 3:47 p.m. hbammkanti


  //Two-dimensional arrays in C
#include <stdio.h>
int main()
{
   int i,j;
   int num1[3][4],num2[3][4];
   printf("Enter the elements of 3X4 array num1\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num1[i][j]);

   printf("Enter the elements of 3X4 array num2\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num2[i][j]);

   printf("The subtraction of num1 and num2 is\n");
   for(i=0; i<3; i++)
    {
      for(j=0; j<4; j++)
      printf("%3d ", (num1[i][j] - num2[i][j]));
      printf("\n");
    }
   return 0;
}

12-08-24, 3:03 p.m. Nikki5D4


 //Two-dimensional arrays in C
#include <stdio.h>
int main()
{
   int i,j;
   int num1[3][4],num2[3][4];
   printf("Enter the elements of 3X4 array num1\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num1[i][j]);

   printf("Enter the elements of 3X4 array num2\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num2[i][j]);

   printf("The subtraction of num1 and num2 is\n");
   for(i=0; i<3; i++)
    {
      for(j=0; j<4; j++)
      printf("%3d ", (num1[i][j] - num2[i][j]));
      printf("\n");
    }
   return 0;
}

12-08-24, 3:18 p.m. 238T1A05D3


#include <stdio.h>
int main()
{
   int i,j;
   int num1[3][4],num2[3][4];
   printf("Enter the elements of 3X4 array num1\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num1[i][j]);

   printf("Enter the elements of 3X4 array num2\n");
   for(i=0; i<3; i++)
   for(j=0; j<4; j++)
   scanf("%d", &num2[i][j]);

   printf("The subtraction of num1 and num2 is\n");
   for(i=0; i<3; i++)
    {
      for(j=0; j<4; j++)
      printf("%3d ", (num1[i][j] - num2[i][j]));
      printf("\n");
    }
   return 0;
12-08-24, 3:19 p.m. tanmayi.P


#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3]=0;
printf("enter elements in array a:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
printf("enter elements in array b:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
c[i][j]=a[i][j]-b[i][j];
printf("difference between the two arrays is:%d"'c[i][j]);
getch();
}

output :
enter elements in array a :
1 2 3 4 5 6 7 8 9 
enter elements in array b:
1 2 3 4 5 6 7 8 9
difference between the two arrays is 
0 0 0 0 0 0 0 0 0


12-08-24, 3:47 p.m. 238T1A05D9


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3]=0;
printf("enter the elements of 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("enter the elements in 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3:j++)
scanf("%d",&b[i][j]);
c[i][j]=a[i][j]-b[i][j];
printf("%d value",c[i][j]);
getch();
}
12-08-24, 3:58 p.m. 238T1A05D8


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3]=0;
printf("enter the elements of 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("enter the elements in 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3:j++)
scanf("%d",&b[i][j]);
c[i][j]=a[i][j]-b[i][j];
printf("%d value",c[i][j]);
getch();
}
12-08-24, 4:13 p.m. Shalini_09


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3]=0;
printf("enter the elements of 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("enter the elements in 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3:j++)
scanf("%d",&b[i][j]);
c[i][j]=a[i][j]-b[i][j];
printf("%d value",c[i][j]);
getch();
}

16-08-24, 5:04 p.m. 238T1A05F5



<hr>
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3]=0;
printf("enter elements in array a:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
printf("enter elements in array b:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
c[i][j]=a[i][j]-b[i][j];
printf("difference between the two arrays is:%d"'c[i][j]);
getch();
}

output :
enter elements in array a :
9 8 7 6 5  4 3 2 1 
enter elements in array b:
1 2 3 4 5 4 3 2 1
difference between the two arrays is 
8 6 4 2 0 0 0 0 0
19-08-24, 2:25 p.m. 238T1A05G7


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3]=0;
printf("enter the elements of 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("enter the elements in 3x3 array");
for(i=0;i<3;i++)
for(j=0;j<3:j++)
scanf("%d",&b[i][j]);
c[i][j]=a[i][j]-b[i][j];
printf("%d value",c[i][j]);
getch();
}
19-08-24, 3:21 p.m. nasreensk2005@gmail.com


#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3]=0;
printf("enter elements in array a:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
printf("enter elements in array b:");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
c[i][j]=a[i][j]-b[i][j];
printf("difference between the two arrays is:%d"'c[i][j]);
getch();
}

output :
enter elements in array a :
1 2 3 4 5 6 7 8 9 
enter elements in array b:
1 2 3 4 5 6 7 8 9
difference between the two arrays is 
0 0 0 0 0 0 0 0 0
19-08-24, 3:59 p.m. 238T1A05G1


Log-in to answer to this question.