Design a program using an array that searches a number if it
is found on the list of the given input numbers and locate
its exact location in the list.

Answer Posted / ashwin kumar

dear no need of pointer for the above Question dear

#include<stdio.h>
#include<conio.h>
void main()
{
int ch[100],m,n,flag=0;
printf("enter the limit value");
scanf("%d",&m);
for(int i=0;i<m;i++)
scanf("%d",&a[i]);
printf("enter the number u are searching for :");
scanf("%d",&n);
for(i=0;i<m;i++)
{
if(a[i]==n)
{
printf("%d number is found at the position %d in the
given array ",n,i);
i=m;// to come out from the loop when we found
searching number
flag=1;

}
}


if( flag = 0)
{
printf(" given number is not found in the list of array");

}




getch();
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In a byte, what is the maximum decimal number that you can accommodate?

636


What is wrong with this program statement? void = 10;

833


what does static variable mean?

659


Explain threaded binary trees?

689


What does dm mean sexually?

828






Explain the advantages and disadvantages of macros.

634


Explain what are the advantages and disadvantages of a heap?

610


Is calloc better than malloc?

597


Is c a great language, or what?

616


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

670


What is an auto keyword in c?

655


What is the explanation for prototype function in c?

579


What is structure in c definition?

583


What are dangling pointers? How are dangling pointers different from memory leaks?

640


What are the different types of linkage exist in c?

623