Created
February 25, 2018 17:43
-
-
Save gallirohik/e4428723e788ef79d81cdff5d4df8b2b to your computer and use it in GitHub Desktop.
Missed number in an array
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
int lsearch(int *arr,int length) | |
{ | |
int i; | |
for(i=0;i<length;i++) | |
if(arr[i]==0)return i+1; | |
} | |
int main() | |
{ | |
int arr[50]={0},n,i,buffer; | |
printf("Enter size of the array:"); | |
scanf("%d",&n); | |
for(i=0;i<n-1;i++) | |
{ | |
scanf("%d",&buffer); | |
arr[buffer-1]=1; | |
} | |
printf("Missed Element is:%d",lsearch(arr,n)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment