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
How can you access memory located at a certain address?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
What is the purpose of 'register' keyword in c language?
Is c high or low level?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
Do pointers store the address of value or the actual value of a variable?
How can you find the day of the week given the date?
Can variables be declared anywhere in c?
What is sizeof int?
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
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
How can I manipulate strings of multibyte characters?
When should the register modifier be used? Does it really help?
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.?
What is calloc()?