Advertisement
Mikeellee

zad6

Dec 1st, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. float tab[100][100];
  9. int n,m,iloczyn=-9999,suma=9999,t,sun,ilm;
  10.  
  11. cout<<"podaj ilosc wierszy: ";
  12. cin>>n;
  13. cout<<"podaj ilosc kolumn: ";
  14. cin>>m;
  15.  
  16.  
  17. for(int i=0;i<n;i++)
  18. {
  19. for(int j=0;j<m;j++)
  20. {
  21. cout<<"Podaj wartosc o wspolrzednych "<<i<<","<<j<<": ";
  22. cin>>tab[i][j];
  23. }
  24. }
  25. for(int i=0;i<n;i++)
  26. {
  27. for(int j=0;j<m;j++)
  28. {
  29. cout<<tab[i][j]<<"\t";
  30. }
  31. cout<<"\n";
  32. }
  33.  
  34. for(int i=0;i<m;i++)
  35. {
  36. t=tab[0][i]*tab[1][i];
  37. if(t>iloczyn)
  38. {
  39. iloczyn=t;
  40. ilm=i;
  41. }
  42.  
  43. }
  44. for(int i=0;i<n;i++)
  45. {
  46. t=tab[i][0]+tab[i][1]+tab[i][2];
  47. if(t>suma)
  48. {
  49. suma=t;
  50. sun=i;
  51. }
  52.  
  53. }
  54.  
  55. cout<<"Najwiekszy iloczyn: "<<tab[0][ilm]<<","<<tab[1][ilm]<<endl;
  56. cout<<"Najwieksza suma: "<<tab[sun][0]<<","<<tab[sun][1]<<","<<tab[sun][2]<<endl;
  57.  
  58. return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement