Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout<<"Witaj w programie, ktory liczy stosunek sumy elementów wewnętrznych do zewnętrznych w macierzy kwadratowej."<<endl;
- cout<<"Wprowadz wymiary wiersza oraz kolumny w postaci liczb rzeczywistych: "<<endl;
- float x[10][10];
- float m,n;
- cin>>n>>m;
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<m;j++)
- {
- cout<<"Wprowadz kolejno wartosc wiersza oraz wartosc kolumny: "<<endl;
- cin>>x[i][j];
- }
- }
- float elwew=0;
- float sumaelwew=0;
- for (int i=1;i<n-1;i++)
- {
- for (int j=1;j<m-1;j++)
- {
- elwew=elwew+x[i][j];
- }
- }
- cout<<"Suma elementow wewnetrznych wynosi: "<<elwew<<endl;
- float allel=0;
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<m;j++)
- {
- allel=allel+x[i][j];
- }
- }
- cout<<"Suma elementow wszystkich wynosi: "<<allel<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement