Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a[100][100],n,i,j,p=1,ok=1;
- float x;
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++)
- for (j=0;j<n;j++)
- cin>>a[i][j];
- for (i=1;i<n;i++) {
- x=(float)a[0][i]/(float)a[0][0];
- ok=1;
- for (j=1;j<n&&ok;j++)
- if ((float)a[j][i]/(float)a[j][0]!=x)
- ok=0;
- if (ok)
- p*=x;
- }
- cout<<"prod="<<p;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement