Design a program using an array that lists even numbers and
odd numbers separately from the 12 numbers supplied by a user.

Answer Posted / atul shukla

in list 12 all can be even or all can be odd so it require
3 array of same size

#include<stdio.h>
void main()
{
int a[12],even[12],odd[12],i,c=0,d=0;
printf("enter 12 numbers");
for(i=0;i<12;i++)
scanf("%d",&a[i]);
for(i=0;i<12;i++)
(n[i]%2==0)?even[c++]=a[i]:odd[d++]=a[i];
printf("seprate list of odd entries");
for(i=0;i<=d;i++)
printf("%d",odd[i]);
printf("seprate list of even entries");
for(i=0;i<=d;i++)
printf("%d",even[i]);
}

Is This Answer Correct ?    2 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between ++a and a++?

699


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

815


Which is best linux os?

567


Why main is used in c?

592


Does free set pointer to null?

566






What is s or c?

602


What is "Hungarian Notation"?

639


What is your stream meaning?

610


Can a pointer be static?

629


How do you list a file’s date and time?

637


How can I swap two values without using a temporary?

621


What are the 5 types of organizational structures?

554


What is a pointer variable in c language?

649


Can you please explain the difference between malloc() and calloc() function?

623


Is null always equal to 0(zero)?

589