# program coding

Ayyanar
program coding
2 Answer(s)      6 years and 2 months ago
Posted in : Java Interview Questions

how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program.

June 23, 2011 at 12:10 PM

Can u give me sample output u want to have output

June 23, 2011 at 2:44 PM

```/*
* Array starts with one not with zero so
* First element will be dummy
*
* so I have written displsy
*/
```

class SortEvevOdd {

```public int[] sort(int a[])
{
/*
* Odd element sorting
*/

for(int i=1;i<a.length;i=i+2)
{
for(int j=i+2;j<a.length;j=j+2)
{
if(a[i]<a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}

/*
* Even element sorting
*/

for(int i=2;i<a.length;i=i+2)
{
for(int j=i+2;j<a.length;j=j+2)
{
if(a[i]<a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
return a;
}

public void display(int a[])
{System.out.println("itt\teven\todd");
for(int i=1;i<a.length;i++)
{
if(i%2==0)
System.out.println(i+"\t"+a[i]);
else
System.out.println(i+"\t"+"\t"+a[i]);
}

}
```

} public class Ref4 { public static void main(String args[]) { SortEvevOdd s=new SortEvevOdd(); int a[]={0,10,20,30,40,50,60};

```    s.display(s.sort(a));
}
```

}

program coding
program coding  how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program.please provide the coding for this problem
program coding
program coding  how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program
program coding
program coding  write a c program to rearrange the array a[1]. . .a[n] in such a way that all even elements precede all odd elements (not changing the order inside each of the two groups
program coding
program coding  Throughout a program text the operation "x to the power y"was denoted by x**y. It was decided that notation should be changed to x^y.How do we do that? the input text is read character-by-character;the output
program coding
program coding  Throughout a program text the operation "x to the power y" was denoted by x**y.It was decided that notation should be changed to x^y.how do we do that?The input text is a decimal number or not,and the number may
simple webdesign program with coding
simple webdesign program with coding  how to design a webpage using html   Please go through the following link: HTML Tutorials
coding
coding
coding  write a program to create file using thread 1 and read the same file using thread2 and disply
coding
coding  write a program to create a file using thread1 and read the file using thread2 and display in the console
coding
coding  Write a java program to Create table - Employee containing empId String (20), empName String (50), DOB Date, deptId String(20). Primary key is empId. Foreign Key is deptId. Populate some records
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.  please provide online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.   Create table test
coding C
coding C  Write a program for a GENERAL NUMBER CONVERTERS which include binary, decimal, octa and hexadecimal. You need to write the program using C language
Java Coding Standards
Java Coding Standards       Coding conventions are the rules that a programmer should govern while develop a program so that their source code can be read and maintain easily. Coding
Coding for life cycle in threads
Coding for life cycle in threads  program for life cycle in threads
Server Side Coding
Server Side Coding       Server Side Coding, on the other hand is the script that does not visually seen on the clients’ terminal but it supports the whole program
coding shape
coding shape  i need to write a simple java program. the system must be in an applet and allows a user to choose whether to draw shapes such as circles, rectangles or lines on the screen. also, user can add circles by choosing
coding for project
coding for project  hai how to write jsp coding for project smart accessories ...... that s to navigate to another page when you click on a tag
Java Coding
Java Coding  Hello, Can u please tel me how to improve my coding techniques.I am feeling difficulty with coding but I am perfect with my theory part
coding for chart
coding for chart  I want to convert a character into binary then convert it into its diagram in form of digital electrical signals.How can I do java coding for this diagram
coding of button
coding of button  What is code of fetching the value of button in a textbox using javascript
problem i coding
problem i coding  i have a problem in coding a combobox containing a number of *.java program on click one of them that program should compile and run and display the result in other window
need coding
need coding  sir i need code for simple bank application in jsp please send it   sir i need the coding for simple bank application in jsp.   Please visit the following link: Jsp Bank Application
Java coding for beginners
are especially for the beginners who want to incept the Java program from very beginning. Tutorial Java coding for beginners will enable you to know about the Java Coding and its various aspects during programming. It also introduces
j2me coding - Java Magazine
in sms using j2me. i have a problem in coding for sending and receiving sms .i have a coding for receiving sms but it not work because that program need sending... a coding for sending and receiving sms in j2me
coding for anchor tags
coding for anchor tags  coding for anchor tags
coding for anchor tags
coding for anchor tags  coding for anchor tags