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

When we use void main and int main?

1018


hi send me sample aptitude papers of cts?

2106


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2584


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

1204


What is the use of typedef in c?

990


How pointer is different from array?

1018


What is header file definition?

1024


What is a macro in c preprocessor?

1051


What are the main characteristics of c language describe the structure of ac program?

1149


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1034


How does pointer work in c?

1071


How do you construct an increment statement or decrement statement in C?

1176


How many types of functions are there in c?

1064


What are # preprocessor operator in c?

1043


What are dangling pointers in c?

1119