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
What is the c language function prototype?
How can I call fortran?
In c language can we compile a program without main() function?
How can a process change an environment variable in its caller?
Is swift based on c?
What are the difference between a free-standing and a hosted environment?
how should functions be apportioned among source files?
Explain why can’t constant values be used to define an array’s initial size?
What is the use of clrscr?
Explain void pointer?
Write a program with dynamically allocation of variable.
What oops means?
Explain the concept and use of type void.
What is the difference between declaring a variable and defining a variable?
How is null defined in c?