Skip to content

Commit e4e54f8

Browse files
committed
Create problem2.c
1 parent c3dfef8 commit e4e54f8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

problem2.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Here is the solution for Amazon Problem No. 2
2+
3+
#include<stdio.h>
4+
void main()
5+
{
6+
int i,n,temp;
7+
int a[20];
8+
int flag[20];
9+
for(i=1;i<=n;i++)
10+
{
11+
flag[i]=0;
12+
}
13+
printf("enter the size of the array\n");
14+
scanf("%d",&n);
15+
printf("Enter the numbers one by one\n");
16+
for(i=1;i<=n;i++)
17+
{
18+
scanf("%d",&temp);
19+
a[i]=temp;
20+
}
21+
for(i=1;i<=n;i++)
22+
{
23+
flag[a[i]]+=1;
24+
}
25+
printf("the element not in the array are:");
26+
for(i=1;i<=n;i++)
27+
{
28+
if(flag[i]==1)
29+
printf("\n%d",i);
30+
}
31+
}

0 commit comments

Comments
 (0)