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

array contains zeros and ones as elements.we need to bring
zeros one side and one other side in single parse.
ex:a[]={0,0,1,0,1,1,0,0}
o/p={0,0,0,0,0,1,1,1}

Answer Posted / ashok kannan

#include<stdio.h>
#include<conio.h>
void main()
{
int a[]={0,0,1,0,1,1,0,0};
int t,j=0,k=0;
while(a[j]!='\0')
{
if(a[j]==1)
j++;

if(a[k]==0)
k++;

t=i;
a[i]=a[j];
a[j]=a[t];

printf("%d",a[j]);
}
}

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

2158


Explain how can you determine the size of an allocated portion of memory?

1117


Who developed c language and when?

1071


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

1110


What is the explanation for the dangling pointer in c?

1117


In C programming, how do you insert quote characters (‘ and “) into the output screen?

1536


What is the method to save data in stack data structure type?

1092


Why c is called free form language?

1024


Is null equal to 0 in sql?

1152


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

1259


How do you define CONSTANT in C?

1283


How to declare pointer variables?

1248


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1947


What is the size of enum in c?

1119


What are the advantages of union?

1071