Search
 
SCRIPT & CODE EXAMPLE
 

C

search array element in c

#include <stdio.h>

int main()
{
    int ara[10]={1,2,3,4,5,6,7,8,9,10};
    int i,is_found=-1,search_value;
    printf("Enter search value:
");
    scanf("%d",&search_value);
    for(i=0;i<10;i++){
        if(ara[i]==search_value){
            is_found=i;
        }
    }
    
    if(is_found==-1){
        printf("Item not found
");
        
    }else{
        printf("Item found at index on. %d
",is_found);
    }

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: c Program for Sum of the digits of a given number 
C :: nested loop in c 
C :: c language append line to file 
C :: c iterate string 
C :: c bit access union 
C :: c convert number to string 
C :: check if the c code is a palindrome 
C :: function for quicksort in c 
C :: check prime number or not c 
C :: mariadb utf8mb4 
C :: c read csv 
C :: mongodb update 
C :: goto statement in c 
C :: bash while loop n times 
C :: add a item to cart woocomerce with quantity 
C :: double array in c 
C :: epoch time in c 
C :: inputting an array in c 
C :: bootsrap textbox 
C :: print hello world in c 
C :: c programming 
C :: Rounding Floating Point Number To two Decimal Places in C 
C :: print an int c 
C :: how to select numeric columns in r 
C :: c assignment operators 
C :: rust set toolchain 
C :: C special character display 
C :: stack pop 
C :: hostbuilder add environment variables 
C :: how to print chicken in c 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =