-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogram9_2.c
51 lines (41 loc) · 921 Bytes
/
program9_2.c
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
// accept N numbers from user and display all such elements which are
//divisible by 5
#include<stdio.h>
#include<stdlib.h>
void Display(int Arr[],int iLength)
{
int iNo;
if(iNo <0)
{
iNo = -iNo;
}
while(iNo !=0)
if((iNo % 5) == 0 )
{
iNo++;
}
}
int main()
{
int iSize = 0,iRet=0;
int iLength =0;
int *p = NULL;
int iCnt = 0;
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;
}
printf("Enter the elements : %d\n",iLength);
for(iCnt = 0; iCnt < iLength; iCnt++)
{
printf("enter elements: %d",iCnt+1);
scanf("%d",p[iCnt]);
}
Display(p,iSize);
free(p);
return 0;
}