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

How can you call a function, given its name as a string?

941


What is indirection? How many levels of pointers can you have?

939


Can we access array using pointer in c language?

886


Why is c called a structured programming language?

1027


What are predefined functions in c?

817


What is the use of a semicolon (;) at the end of every program statement?

1174


How is pointer initialized in c?

812


What does dm mean sexually?

1083


What is the use of gets and puts?

802


What is the most efficient way to store flag values?

936


What is a memory leak? How to avoid it?

930


What is sorting in c plus plus?

763


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

885


Write a program with dynamically allocation of variable.

887


What is calloc in c?

913