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
What is line in c preprocessor?
What is the purpose of & in scanf?
what is a function method?give example?
How can I prevent another program from modifying part of a file that I am modifying?
What does do in c?
Can a pointer be null?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Explain pointer. What are function pointers in C?
The __________ attribute is used to announce variables based on definitions of columns in a table?
What do you mean by a local block?
Write a program to check prime number in c programming?
Is javascript based on c?
Can 'this' pointer by used in the constructor?
How do you determine a file’s attributes?
Do string constants represent numerical values?