Created
October 1, 2018 08:04
-
-
Save simplyniceweb/0f3666e29eb546e04ca153186bb18f88 to your computer and use it in GitHub Desktop.
multi dimensional array c lang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
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