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

What does sizeof function do?

1179


Explain that why C is procedural?

1127


can we implement multi-threads in c.

1119


What happens if a header file is included twice?

1027


What is variable and explain rules to declare variable in c?

1073


What are pointers really good for, anyway?

1050


Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

1261


What are different storage class specifiers in c?

1079


How to establish connection with oracle database software from c language?

2181


Is c pass by value or reference?

1027


Explain data types & how many data types supported by c?

1071


Explain how can you tell whether two strings are the same?

1000


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

1168


Is it possible to pass an entire structure to functions?

989


Explain how do you determine whether to use a stream function or a low-level function?

1071