Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- printf("Da se sustavi programa za obrabotka na masiva A[N,N], kudeto dannite sa celi chisla v intervala [-1000;1000]. Programata da izvurshi slednite deistviq:\n");
- printf("Da se nulirat elementite ot masiva A, za koito sumata sus suotvetniq element ot masiva B e chetno chislo prinadlejashto na zadaden interval [K, L]\n");
- printf("Da se opredeli broq na promenenite elementi v masiva A\n");
- printf("Avtor: ..........\n");
- int n;
- printf("Enter size of the array A and B: ");
- scanf("%d", &n);
- int A[n][n];
- int B[n][n];
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- printf("A[%d][%d] = ", i, j);
- scanf("%d", &A[i][j]);
- }
- }
- printf("---------------\n");
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- printf("A[%d][%d] = %d\n", i, j, A[i][j]);
- }
- }
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- printf("B[%d][%d] = ", i, j);
- scanf("%d", &B[i][j]);
- }
- }
- printf("---------------\n");
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- printf("B[%d][%d] = %d\n", i, j, B[i][j]);
- }
- }
- int k, l;
- printf("K = ");
- scanf("%d", &k);
- printf("L = ");
- scanf("%d", &l);
- int changes = 0;
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- int sum = A[i][j] + B[i][j];
- if(sum % 2 == 0 && sum >= k && sum <= l){
- A[i][j] = 0;
- changes++;
- }
- }
- }
- printf("a)---------------\n");
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- printf("A[%d][%d] = %d\n", i, j, A[i][j]);
- }
- }
- printf("b)---------------\n");
- printf("Promeneni elementi: %d", changes);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement