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 |
Can a variable be both static and volatile in c?
Are there namespaces in c?
how to construct a simulator keeping the logical boolean gates in c
fn f(x) { if(x<=0) return; else f(x-1)+x; }
What is difference between union All statement and Union?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
What is the Lvalue and Rvalue?
Hi can anyone tell what is a start up code?
Difference between null pointer and dangling pointer?
Define circular linked list.
write a program to add two numbers of any size.....(remember any size)
Can stdout be forced to print somewhere other than the screen?