Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / belsia

#include<stdio.h>
#include<conio.h>
void main()
{
int a[12],b[12],c[12],i,j=0,k=0;
clrscr();
printf("Enter 12 numbers\n");
for(i=0;i<12;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<12;i++)
{
if((a[i]%2)==0)
{
b[j]=a[i];
j++;
}
else
{
c[k]=a[i];
k++;
}
}
printf("The even numbers are\n");
for(i=0;i<j;i++)
{
printf("%d\n",b[i]);
}
printf("The odd numbers are\n");
for(i=0;i<k;i++)
{
printf("%d\n",c[i]);
}
getch();
}

Is This Answer Correct ?    66 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

code for quick sort?

2008


What is the use of bitwise operator?

1110


What are the disadvantages of c language?

1173


what does static variable mean?

1088


Is c compiled or interpreted?

1176


What is || operator and how does it function in a program?

1072


A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

2303


What is advantage of pointer in c?

1169


Can include files be nested? How many levels deep can include files be nested?

1140


why we wont use '&' sing in aceesing the string using scanf

2356


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1940


A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile

1079


What are the benefits of organizational structure?

1008


Why do we need a structure?

1023


Explain what header files do I need in order to define the standard library functions I use?

1158