How to write a C Program To Search A Number Inside The Array in C Programming Language ?
Solution For C Program :
/*C Program To Search A Number Inside The Array.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,num,flag=0,arr[5];
printf("Enter 5 numbers for array:=\n");
for(i=0;i<5;i++)
{
scanf("%d",&arr[i]);
}
printf("Enter number u want to search:=");
scanf("%d",&num);
for(i=0;i<5;i++)
{
if(arr[i]==num)
{
printf("number %d do exist in present array",num);
flag=1;
break;
}
}
if(flag==0)
{
printf("number does not exist in the present array");
}
getch();
}
You may also learn these C Program/Code :
C Program To Swap Two Numbers Without Using Third Variable
Learn More :
Number
- Find out the perfect number using c program
- Write a c program to find out H.C.F. of two numbers.
- Check the given number is armstrong number or not using c program.
- Write a c program to find largest among three numbers using conditional operator
- FIND OUT GENERIC ROOT OF A NUMBER - C PROGRAM.
- FIND PRIME FACTORS OF A NUMBER USING C PROGRAM
- How To Write a C program that generates two random numbers ?
- Write a C program to find maximum or equal between two numbers ?
- How to Write a C program to find maximum between two numbers ?
- Write a C program to perform math operations on two input whole numbers. The operations are:
- Write a C program to find maximum between three numbers ?
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C Program to Enter an ODD number between 1 and 49.
- C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.
- C program generates a random number and uses an algorithm to generate 9 other numbers.
- C Program to Find Random Number
- C Program To Find LCM and HCF Of Two Number Using Function - 2
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Find LCM and HCF Of Two Number -1
- C Program To Find Reverse Of Any Digit Number
- C Program To Find The Frequency Of A Number
- C Program To Print Prime Numbers Upto The Number You Want
- C Program To Print Sum Of n Digit Number
- C Program To Reverse A Number
Search
- Dictionary Word Search C Program
- C Depth First Search
- C Program To Write Data In A File And Search Data From File
- C Program to search an element using linear search or binary search (menu driven program)
- C Program Performs a search and replace for a specified target and replacement string
- C Program Recursive function that searches for a given file in a given folder
- Pre Order, Post order, In order Implement Binary Tree using linked list
- BST Tree in C
- C Program Search Function For Sequence
- Linked List For Getting Employee Details, Display and Search For Salary C Program
- Menu driven program in the creation,display,search, insertion and deletion of a node in the linked list
Array
- How to pass one dimensional array to function in c.
- Write a c program which passes two dimension array to function.
- C Program Array Index Example
- C Program Array Example: Average
- C Program Array Example: Reverse
- C Program Array Example
- C Program to Array
- C Program Array NxM Elements Geometric/Arithmetic
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Union & Intersection Of Two Array
- C Program To Sort An Array In Ascending And Descending Order
- C Program To Sort An Array Of Names In Alphabetical And Reverse Order
- C Program To Copy One Character Array Into Another
- Returns: array of decoded values. [0] - count of values
- C Program to Check if a number is in an array[1000]
- C Program to Find max and min in array using pointer concept
- C Program Sort Array By Segment
- C Program to sort an array using bubble sort
- C Program to find smallest in an array using pointer
- C Program to merge and sort two arrays
- Un-sortiertes Array and Sortiertes Array
- C Program to Array Deserialization
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- Input reads in the array positions and range for random generation.