Skip to content

Instantly share code, notes, and snippets.

@gorborukov
Created April 12, 2016 20:46
Show Gist options
  • Save gorborukov/c240c7eaaecf93dabb3ff5301550ef9c to your computer and use it in GitHub Desktop.
Save gorborukov/c240c7eaaecf93dabb3ff5301550ef9c to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j;
int a[5][6],b[6],c[6];
printf("array A input: \n");
for (i=0; i<5; i++) {
for (j=0; j<6; j++) {
printf("Type array a[%d][%d]",i,j);
scanf("%d", &a[i][j]);
c[i]+=a[i][j];
}
}
printf("array B input: \n");
for (i=0; i<6; i++) {
printf("Type array b[%d]",i);
scanf("%d", &b[i]);
}
for (i=0; i<6; i++) {
if (b[j]>0) {
int x=0;
for(j=0;j<6;j++) {
x+=a[i][j];
}
c[j]=x;
}
if(b[j]==0) {
c[j]=0;
}
if(b[j]<0) {
c[j]=a[0][j]+a[4][j];
}
}
printf("array C:\n");
for (j=0; j<5; j++) {
printf("%d", c[j]);
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment