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 |
Write a program to print distinct words in an input along with their count in input in decreasing order of their count
What is variable and explain rules to declare variable in c?
What is array in C
How can I write a function that takes a format string and a variable number of arguments?
What is a example of a variable?
who developed c and why he developed c?
What is the relationship between pointers and data structure?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
How can you allocate arrays or structures bigger than 64K?
Explain what are its uses in c programming?
What is uint8 in c?
How can I find out how much memory is available?