I want to write a program that takes the value of the user if it is in the arrays to show the array number if it does not respon | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to write a program that takes the value of the user if it is in the arrays to show the array number if it does not respon

20th Jul 2017, 10:26 AM
M .Q
2 Answers
0
int i,ch;flag=0; printf("enter no. to be searched in array:"); scanf(%d,&ch); for(i=0;i<arr.length();i++) { if(ch==arr[i]) { printf("\n The no %d is at location %d",ch,i+1); flag=1; break; } if(flag!=1) printf("element not in array");
20th Jul 2017, 11:21 AM
Naveed Jeelani Khan
Naveed Jeelani Khan - avatar
0
java
21st Jul 2017, 11:05 AM
M .Q