Our website is made possible by displaying online advertisements to our visitors.Please consider supporting us by disabling your ad blocker.
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Translate it in your own Language

Print this Job Post

Print Friendly and PDF

Wednesday, May 28, 2014

Subtract matrices

C programming code

#include <stdio.h>
#include<conio.h> 
void main()
{
  int m, n, c, d, first[10][10], second[10][10], difference[10][10];
  clrscr();
  printf("Enter the number of rows and columns of matrix\n");
  scanf("%d%d", &m, &n);
  printf("Enter the elements of first matrix\n");
  for (c = 0; c < m; c++)
  for (d = 0 ; d < n; d++)
  scanf("%d", &first[c][d]);
  printf("Enter the elements of second matrix\n");
  for (c = 0; c < m; c++)
  for (d = 0; d < n; d++)
  scanf("%d", &second[c][d]);
  for (c = 0; c < m; c++)
  for (d = 0; d < n; d++)
  difference[c][d] = first[c][d] - second[c][d];
  printf("difference of entered matrices:-\n");
  for (c = 0; c < m; c++)
  {
    for (d = 0; d < n; d++)
      printf("%d\t",difference[c][d]);
     printf("\n");
  }
 getch();
}

Output of program:


No comments:

Post a Comment

Copyright @ CrackMNC 2014-2024
Divas Nikhra Theme by Crack MNC