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 / vignesh1988i

A SMALL FLOWER BRACES IS LEFT.......

THE FOLLOWING IS THE RIGHT PROGRAM


#include<stdio.h>
#include<conio.h>
void main()
{
int a[100],*ptr[50],count=0,n,flag=1;
printf("enter the max. elements to be entered :");
scanf("%d",&n);
int k=0;
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]%2!=0)
{
ptr[k]=&a[i];
count++;
k++;
}
else
flag=0;
}
printf("odd numbers :\n");
for(i=0;i<count;i++)
printf("%d\n",*(*(ptr+i)));
if(flag==0)
{
printf("even numbers :\n");
for(i=0;i<n;i++)
{
if(ptr[i]!=&a[i])
printf("%d\n",a[i]);
}
}
getch();
}

Is This Answer Correct ?    2 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the difference between a free-standing and a hosted environment?

1126


What are 3 types of structures?

1027


Why c is a mother language?

965


What are linker error?

1036


What is return in c programming?

917


What extern c means?

931


What is structure in c language?

1096


What is array of structure in c programming?

1240


How can you return multiple values from a function?

1051


Explain what is wrong with this program statement? Void = 10;

1195


What is the use of header files?

1058


Difference between pass by reference and pass by value?

1097


How do I determine whether a character is numeric, alphabetic, and so on?

1070


What is static memory allocation?

1099


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

1383