Advertisement
rotti321

Citire/afisare sir/matrice

May 5th, 2022
716
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///sir de numere
  2.  
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n,s[16],i;
  10.     cin>>n;
  11.     for(i=1;i<=n;i++){
  12.         cin>>s[i];
  13.     }
  14.     for(i=1;i<=n;i++){
  15.         cout<<s[i]<<" ";
  16.     }
  17.     return 0;
  18. }
  19.  
  20.  
  21. ///matrice oarecare
  22. #include <iostream>
  23.  
  24. using namespace std;
  25.  
  26. int main()
  27. {
  28.     int n,m,a[21][21],i,j;
  29.     cin>>n>>m;
  30.     for(i=1;i<=n;i++){
  31.         for(j=1;j<=m;j++){
  32.             cin>>a[i][j];
  33.         }
  34.     }
  35.     for(i=1;i<=n;i++){
  36.         for(j=1;j<=m;j++){
  37.             cout<<a[i][j]<<" ";
  38.         }
  39.         cout<<endl;
  40.     }
  41.     return 0;
  42. }
  43.  
  44.  
  45.  
Advertisement
RAW Paste Data Copied
Advertisement