Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <assert.h>
- #define ItemToFind 6
- int main(int argc, char const *argv[]) {
- int i;
- int finish = 1;
- int count = 0;
- int amount = 0;
- int array[amount];
- printf("Array size? \n");
- scanf("%d", &amount);
- for(i=0; i < amount; i++) {
- scanf("%d", &array[i]);
- }
- for(i=0; i<=amount; i++) {
- while(i < amount && finish == 1){
- count++;
- printf("%d\n", array[i]);
- if(array[i] == ItemToFind){
- count++;
- printf("Found in. %d counts\n" ,count);
- finish = 0;
- break;
- }else{
- printf("Not Found\n");
- i++;
- }
- }
- }
- if(finish == 1){
- printf("Can't find\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement