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
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
What is the difference between struct and union in C?
What is d scanf?
Explain the Difference between the New and Malloc keyword.
What are the types of i/o functions?
What is the purpose of macro in C language?
What is the difference between ++a and a++?
plz let me know how to become a telecom protocol tester. thank you.
Tell me when would you use a pointer to a function?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
Define VARIABLE?
How is a structure member accessed?
Why we use int main and void main?
Where local variables are stored in c?
What is a pointer in c plus plus?