write a program in c to read array check element is present or
not?
Answer / tatukula
#include<stdio.h>
int main()
{
char array[10]={0,1,2,3,4,5,6,7,8,9};
int check;
int i,flag=0;
printf("enter number you want to check in array\n");
scanf("%d",&check);
for(i=0;i<=sizeof(array);i++)
{
if(array[i] == check)
{
flag = 1;
break;
}
}
if(flag)
printf("element is present in the array\n");
else
printf("element is not present in the array\n");
}
input: 4
output: element is present in the array
input: 45
output: element is not present in the array
| Is This Answer Correct ? | 5 Yes | 0 No |
12344321 123 321 12 21 1 1 how i print this program??
5 Answers DSR Management, Winit,
What is the difference between typedef and #define?
What is fflush() function?
what is the difference between c and c++?
What is character constants?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Where are c variables stored in memory?
What are the modifiers available in c programming language?
What is pointer in c?
Determine the code below, tell me exactly how many times is the operation sum++ performed ? for ( i = 0; i < 100; i++ ) for ( j = 100; j > 100 - i; j--) sum++;
Explain what is the difference between #include and #include 'file' ?
What is the purpose of sprintf() function?