Jump to content

Recommended Posts

  • Moderators
Posted

Sa se scrie un program in C care, folosind un meniu, sa citeasca de la tastatura 2 matrici patratice cu numere intregi, de dimensiune specificata de utilizator si a se afiseze suma celor 2 matrice.

Rezolvare:

#include<stdio.h>

 int main()

 {

     int a[100][100],b[100][100],n,j,i;

     printf("Ce dimensiune au matricile?\n");

     scanf("%d",&n);

     printf("Introduceti prima matrice:\n");

     for(i=1;i<=n;i++)

      for(j=1;j<=n;j++)

       scanf("%d",&a[i][j]);

     printf("Introduceti a doua matrice:\n");

     for(i=1;i<=n;i++)

      for(j=1;j<=n;j++)

       scanf("%d",&b[i][j]);

     printf("Matricea rezultata in urma sumei:");

     for(i=1;i<=n;i++)

     {

      printf("\n");

      for(j=1;j<=n;j++)

       printf("%d ",a[i][j]+b[i][j]);

     }

     printf("\n");

    }

sursa: tutorialehd.info

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.