write a program to search for an element in a given array.
If the array was found then display its position otherwise
display appropriate message in c language
Answer Posted / mr. x
#include<stdio.h>
#include<conio.h>
void main ()
{
int a[5],b,c,i;
clrscr();
printf("
Enter no. of elements: ");
scanf("%d",&c);
i=0;
while(i<c)
{
scanf("%d",&a[i]);
i++;
}
printf("
Enter the elements to be searched: ");
scanf("%d",&b);
i=0;
while(i<c &b!=a[i])
{
i++;
}
if (i<c)
{
printf("number found");
i++;
}
else
{
printf(" number not found");
}
getch();
}
| Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
How can I open a file so that other programs can update it at the same time?
What is the size of array float a(10)?
Are pointers integers in c?
Can you please explain the difference between strcpy() and memcpy() function?
Does c have function or method?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
What is the size of enum in bytes?
What is the role of this pointer?
What is the difference between variable declaration and variable definition in c?
Describe the steps to insert data into a singly linked list.
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What is indirection?
What is meant by recursion?