Jump to content

Suma A Doua Matrice Patratice


Courage

Recommended Posts

  • Moderators

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.