Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #define N 5
- #define M 5
- using namespace std;
- int main()
- {
- int a[N][M] = {{1, 2, 3, 4, 5},
- {4, 16, 64, 128, 256},
- {0, 2, 5, 6, 7},
- {10, 11, 12, 13, 14},
- {101, 102, 103, 104, 105}};
- int c;
- cin >> c;
- int i, j;
- for(i = 0; i < N; i++){
- for(j = 0; j < M; j++){
- if(j > 0)
- {
- if(a[i][j] < a[i][j-1]){
- printf("Error. Massiv ne otsortirovan.\n");
- return 0;
- }
- }
- if(a[i][j] > c) j = M;
- if(a[i][j] == c) printf("N = %d, M = %d\n", i+1,j+1);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement