-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaarray2.c
More file actions
63 lines (34 loc) · 650 Bytes
/
Copy pathaarray2.c
File metadata and controls
63 lines (34 loc) · 650 Bytes
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
62
63
#include<stdio.h>
int main(){
/*Write a program to remove all the prime numbers and even numbers replace by
1 in an array*/
int i,k,j,size,a[100],count;
printf("Enter the size of the array");
scanf("%d",&size);
printf("enter the elements");
for ( i=0;i<size;i++){
scanf("%d",&a[i]);
}
for ( i=0;i<size;i++){
if (a[i]%2==0)
{
a[i]=1;
}
}
for ( i=0;i<size;i++){
count=0;
for( j=2;j<a[i];j++){
if(a[i]%j==0){
count =1;
}
}
}
if ( count==0){
a[i]=1;
}
for ( i=0;i<size;i++)
{
printf("%d",a[i]);
}
return 0;
}