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
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
What is line in c preprocessor?
Tell me can the size of an array be declared at runtime?
How do you use a 'Local Block'?
Explain what is the stack?
Describe the steps to insert data into a singly linked list.
When should you use a type cast?
What is a pointer and how it is initialized?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What are the advantages of using macro in c language?
What is the acronym for ansi?
Is boolean a datatype in c?
What does volatile do?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
Is main is a keyword in c?