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 / prakash.

/* program to print even nums in even position,odd in odd
position*/
/* Ex: 2 1 3 4 output:2 1 4 3*/
/* work for almost all check it if any wrong*/
#include<stdio.h>
#include<conio.h>

void main()
{
int a[4],j=0,i;
int b[4],e=0,od=1;
clrscr();
for(i=0;i<4;i++)
{
printf("Enter A number : ");
scanf("%d",&a[i]);
}
for(i=0;i<4;i++)
{
if((a[i]%2)==0)
{
j=e;
b[j]=a[i];
e=j+2;
}
else
{
j=od;
b[j]=a[i];
od=od+2;
}
}
for(j=0;j<4;j++)
{
printf("%d\n",b[j]);
}
getch();
return;
}

Is This Answer Correct ?    4 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c value paradox explain?

1019


What is the mean of function?

1064


What is formal argument?

1092


Explain how does flowchart help in writing a program?

1061


In which language linux is written?

1167


Why is it usually a bad idea to use gets()? Suggest a workaround.

1689


What is unsigned int in c?

932


What is the maximum length of an identifier?

1135


Difference between goto, long jmp() and setjmp()?

1124


Can you explain the four storage classes in C?

1067


When is a “switch” statement preferable over an “if” statement?

1071


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2245


Explain the priority queues?

1032


How do we print only part of a string in c?

974


I need previous papers of CSC.......plz help out by posting them.......

2247