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
In a byte, what is the maximum decimal number that you can accommodate?
What is wrong with this program statement? void = 10;
what does static variable mean?
Explain threaded binary trees?
What does dm mean sexually?
Explain the advantages and disadvantages of macros.
Explain what are the advantages and disadvantages of a heap?
Is calloc better than malloc?
Is c a great language, or what?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What is an auto keyword in c?
What is the explanation for prototype function in c?
What is structure in c definition?
What are dangling pointers? How are dangling pointers different from memory leaks?
What are the different types of linkage exist in c?