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

How can you access memory located at a certain address?

751


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

674


What is the purpose of 'register' keyword in c language?

721


Is c high or low level?

676


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

693






Do pointers store the address of value or the actual value of a variable?

702


How can you find the day of the week given the date?

720


Can variables be declared anywhere in c?

717


What is sizeof int?

726


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

1832


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

696


How can I manipulate strings of multibyte characters?

714


When should the register modifier be used? Does it really help?

699


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

717


What is calloc()?

711