**Logic of a Program**

1. Take input from user.

2. Run a loop to check each element of an array. If the remainder of a number is zero by

the division of 2 then It's a even number else it's a odd number.

// Check whether the Remainder of a number is zero by division of 2

if(arr[i]%2==0){

print even no.

} else {

print odd no.

}

### Program to Print Odd and Even Numbers of an Array

// Program

```
#include <stdio.h>
void main()
{
```

` // Declare variables. `

```
int arr[100],i,n;
printf("How many elements you want to enter");
scanf("%d",&n);
printf("Enter the elements in an array");
```

```
```

` // Taking the input from user`

```
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
}
```

` // Logic of even and odd numbers`

```
for(i=0;i<n;i++){
if(arr[i]%2==0){
printf("Even number is %d\n",arr[i]);
}else{
printf("odd number is %d\n",arr[i]);
}
}
}
```

Questions Related to Array

Problem on Linked List

## No comments:

## Post a Comment