Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Citire_matrici_afisare_matrici
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. int i, j, n, m , s = 0;
  13. int[,] v;
  14. Console.Write("n= ");
  15. n = int.Parse(Console.ReadLine());
  16. Console.Write("m= ");
  17.  
  18. m = int.Parse(Console.ReadLine());
  19. v = new int[n,m];
  20. for (i = 0; i <= n-1; i++)
  21. for (j = 0; j <= m-1; j++)
  22. {
  23. v[i,j] = int.Parse(Console.ReadLine());
  24. s = s + v[i, j];
  25. }
  26. Console.WriteLine("Suma este = {0}", s);
  27.  
  28. for (i = 0; i <= n-1; i++)
  29. {
  30. for (j = 0; j <= m-1; j++)
  31. Console.Write("{0} ", v[i, j]);
  32.  
  33. Console.WriteLine("");
  34. }
  35.  
  36. Console.ReadKey();
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement