Skip to content

Instantly share code, notes, and snippets.

@simplyniceweb
Created October 1, 2018 08:04
Show Gist options
  • Save simplyniceweb/0f3666e29eb546e04ca153186bb18f88 to your computer and use it in GitHub Desktop.
Save simplyniceweb/0f3666e29eb546e04ca153186bb18f88 to your computer and use it in GitHub Desktop.
multi dimensional array c lang
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
int main()
{
int a[3][5];
int i,j,k,l;
for(i=0; i<3; i++) {
for(j=0; j<5; j++) {
printf("Enter number:\n");
scanf("%d", &a[i][j]);
}
}
printf("Enter number to look for:\n");
scanf("%d", &k);
for(i=0; i<3; i++) {
for(j=0; j<5; j++) {
if (a[i][j] == k) {
l = 1;
printf("%d found in row %d column %d\n", k, i, j);
}
}
}
if (!l) {
printf("%d not found", k);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment