Răspuns :
Răspuns:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,a[20][20],i,j,s=0,m,b;
printf("b=");
scanf("%d",&b);
printf("introduceti numarul de linii :");
scanf("%d",&n);
printf("Introduceti numarul de coloane :");
scanf("%d",&m);
printf("\nintroduceti elementele matricei :\n");
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
printf("Introduceti elementele [%d,%d] : ",i+1,j+1);
scanf("%d",&a[i][j]);
}
}
printf("\nMatricea este :\n");
for(i=0; i< n; i++)
{
for(j=0; j< m; j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
for(i=1,s=0; i<n; i++)
for(j=0; j<=i-1; j++)
{
if((i+1)%2==0 && a[i][j]<b)
{
s+=a[i][j];
}
}
printf(" Suma este %d",s);
return 0;
}
Explicație:
in loc de <a apartine R am pus in program b