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 |
Why is c called c?
What is cohesion and coupling in c?
How can I trap or ignore keyboard interrupts like control-c?
why Language C is plateform dependent
a C prog to swap 2 no.s without using variables just an array?
What is hash table in c?
write a c program in such a way that if we enter the today date the output should be next day's date.
Write a program to swap two numbers without using the third variable?
which types of data structure will i use to convert infix to post fix???
What are type modifiers in c?
What is line in c preprocessor?
What is scope and lifetime of a variable in c?