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 IMPLEMENTATION OF POINTERS

#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();
}


thank you

Is This Answer Correct ?    3 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is oops c?

1340


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2498


What is c standard library?

1271


How does pointer work in c?

1194


how to find anagram without using string functions using only loops in c programming

3237


write a program to generate address labels using structures?

4622


Is main is user defined function?

1210


Explain how do you search data in a data file using random access method?

1175


Explain the properties of union.

1135


What are the 5 types of inheritance in c ++?

1073


What is a wrapper function in c?

1168


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

1099


What is the process of writing the null pointer?

1062


What are the different types of pointers used in c language?

1099


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

1126