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
Which is the best website to learn c programming?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What oops means?
Is c++ based on c?
Is fortran still used in 2018?
Why is it important to memset a variable, immediately after allocating memory to it ?
What are the salient features of c languages?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What is the difference between %d and %i?
What is getch () for?
Explain the advantages and disadvantages of macros.
What is an endless loop?
Which is best linux os?
int far *near * p; means
What is malloc() function?