-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment10_3.c
More file actions
61 lines (49 loc) · 1.08 KB
/
Assignment10_3.c
File metadata and controls
61 lines (49 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//1.. Accept N numbers from user check whether that numbers contains 11 in it or not.
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
bool countEven(int Arr[],int iLength)
{
int iCnt = 0;
int iEven = 0 , iOdd = 0;
bool bFlag = false;
for(iCnt = 0 ; iCnt < iLength ; iCnt++)
{
if(Arr[iCnt] == 11)
{
bFlag = true;
break;
}
}
return bFlag;
}
int main()
{
int iSize = 0 , iCnt = 0;
int *p = NULL;
bool fRet = false;
printf("Enter number of elements \n");
scanf("%d",&iSize);
p = (int *)malloc(iSize * sizeof(int));
if(p==NULL)
{
printf("Unable to allocate memory");
return -1;
}
for(iCnt = 0; iCnt < iSize ; iCnt++)
{
printf("Enter element : %d\n",iCnt+1);
scanf("%d",&p[iCnt]);
}
fRet = countEven(p , iSize);
if(fRet == true)
{
printf("11 is Present \n ");
}
else
{
printf("11 is not present");
}
free(p);
return 0;
}