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
How can you call a function, given its name as a string?
What is indirection? How many levels of pointers can you have?
Can we access array using pointer in c language?
Why is c called a structured programming language?
What are predefined functions in c?
What is the use of a semicolon (;) at the end of every program statement?
How is pointer initialized in c?
What does dm mean sexually?
What is the use of gets and puts?
What is the most efficient way to store flag values?
What is a memory leak? How to avoid it?
What is sorting in c plus plus?
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);
Write a program with dynamically allocation of variable.
What is calloc in c?