fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. double array[20][20];
  7. srand(time(0));
  8. for (int i=0;i<20;i++)
  9. {
  10. for (int j=0;j<20;j++)
  11. {
  12. array[i][j]=(rand()%100);
  13. }
  14. cout<<endl;
  15. }
  16. double diagonal[20];
  17. for (int i=0;i<20;i++)
  18. {
  19. diagonal [i]=array [i][i];
  20. cout<<diagonal[i]<<" ";
  21. }
  22. cout<<endl;
  23. }
  24.  
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout



















68 35 92 40 71 7 83 86 88 89 35 67 6 0 43 12 42 95 33 65