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 |
How do I use void main?
which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
Is there sort function in c?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What is pass by reference in c?
In the following code segment what will be the result of the function, value of x , value of y { unsigned int x=-1; int y; y = ~0; if(x == y) printf("same"); else printf("not same"); } a) same, MAXINT, -1 b) not same, MAXINT, -MAXINT c) same , MAXUNIT, -1 d) same, MAXUNIT, MAXUNIT e) not same, MAXINT, MAXUNIT
Write a C program to print 1 2 3 ... 100 without using loops?
what is the output on the screen? int n; n=printf("my name is %d",printf("kiran %d",printf("kumar"))); printf("\n %d \n",n);
What are the different properties of variable number of arguments?
simple program of graphics and their output display
#include<stdio.h> void main() { char *str; long unsigned int add; str="Hello C"; add=&str[0]; printf("%c",add); } What is the output?