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

program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

2580


What is the role of && operator in a program code?

576


How can I direct output to the printer?

821


What is the size of enum in c?

625


What is a program?

669






What are the Advantages of using macro

690


How many levels deep can include files be nested?

656


Do you know the use of 'auto' keyword?

666


What does double pointer mean in c?

584


Using which language Test cases are added in .ptu file of RTRT unit testing???

3605


all c language question

1879


Give the rules for variable declaration?

682


What is a function simple definition?

626


What is scope rule in c?

609


What is calloc in c?

667