Click here to Skip to main content
15,887,746 members
Home / Discussions / Java
   

Java

 
AnswerRe: Time Pin
Afzaal Ahmad Zeeshan5-Feb-15 0:20
professionalAfzaal Ahmad Zeeshan5-Feb-15 0:20 
GeneralRe: Time Pin
Member 114289685-Feb-15 19:02
Member 114289685-Feb-15 19:02 
AnswerRe: Time Pin
Richard MacCutchan5-Feb-15 2:43
mveRichard MacCutchan5-Feb-15 2:43 
GeneralRe: Time Pin
Member 114289685-Feb-15 19:03
Member 114289685-Feb-15 19:03 
GeneralRe: Time Pin
Richard MacCutchan5-Feb-15 21:47
mveRichard MacCutchan5-Feb-15 21:47 
QuestionMedian of an Array Pin
PinkPrint3-Feb-15 13:04
PinkPrint3-Feb-15 13:04 
AnswerRe: Median of an Array Pin
Richard MacCutchan3-Feb-15 22:54
mveRichard MacCutchan3-Feb-15 22:54 
AnswerRe: Median of an Array Pin
Akash gods8-Feb-15 9:44
professionalAkash gods8-Feb-15 9:44 
//created by akshgods Wink | ;)
import java.util.*;

class median
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int size=5,temp=0,mid=0,pnt1=0,pnt2=0;
System.out.println("Enter the size of array");

size=sc.nextInt();//taking size for array
int a[]=new int[size];

//taking values in array
System.out.println("Enter the values");
for(int i=0;i<size;i++)
{
a[i]=sc.nextInt();
}

//sorting array with bubbule sort in ascending order
for(int i=0;i<size-1;i++)
{
for(int j=0;j<size-i-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
//printing values in ascending order
System.out.println("values in ascending order");
for(int i=0;i<size;i++)
{
System.out.print(" "+a[i]);
}

//finding medean logic
if(size%2==0)
{
pnt1=size/2;
pnt2=pnt1-1;
mid=(a[pnt1]+a[pnt2])/2;
System.out.println("\nmidean is= "+mid);
}
else
{
pnt1=(size+1)/2;
pnt1--;
mid=a[pnt1];
System.out.println("midean is= "+mid);

}

}
}
GeneralRe: Median of an Array Pin
PinkPrint18-Feb-15 16:16
PinkPrint18-Feb-15 16:16 
QuestionSimple Mathematics. Pin
hansoctantan3-Feb-15 7:19
professionalhansoctantan3-Feb-15 7:19 
AnswerRe: Simple Mathematics. Pin
PIEBALDconsult3-Feb-15 7:36
mvePIEBALDconsult3-Feb-15 7:36 
GeneralRe: Simple Mathematics. Pin
hansoctantan3-Feb-15 7:48
professionalhansoctantan3-Feb-15 7:48 
GeneralRe: Simple Mathematics. Pin
PIEBALDconsult3-Feb-15 7:51
mvePIEBALDconsult3-Feb-15 7:51 
GeneralRe: Simple Mathematics. Pin
hansoctantan3-Feb-15 7:57
professionalhansoctantan3-Feb-15 7:57 
QuestionMax,Min,Average Pin
PinkPrint30-Jan-15 14:29
PinkPrint30-Jan-15 14:29 
SuggestionRe: Max,Min,Average Pin
Richard MacCutchan30-Jan-15 21:53
mveRichard MacCutchan30-Jan-15 21:53 
GeneralRe: Max,Min,Average Pin
Ravi Bhavnani31-Jan-15 5:36
professionalRavi Bhavnani31-Jan-15 5:36 
GeneralRe: Max,Min,Average Pin
PinkPrint31-Jan-15 5:50
PinkPrint31-Jan-15 5:50 
GeneralRe: Max,Min,Average Pin
Ravi Bhavnani31-Jan-15 5:58
professionalRavi Bhavnani31-Jan-15 5:58 
GeneralRe: Max,Min,Average Pin
PinkPrint31-Jan-15 6:02
PinkPrint31-Jan-15 6:02 
GeneralRe: Max,Min,Average Pin
Richard MacCutchan31-Jan-15 6:11
mveRichard MacCutchan31-Jan-15 6:11 
AnswerRe: Max,Min,Average Pin
Akash gods6-Feb-15 7:02
professionalAkash gods6-Feb-15 7:02 
AnswerRe: Max,Min,Average Pin
Akash gods6-Feb-15 21:43
professionalAkash gods6-Feb-15 21:43 
QuestionJComponent cannot be resolved to a type Pin
Member 1141271229-Jan-15 8:10
Member 1141271229-Jan-15 8:10 
SuggestionRe: JComponent cannot be resolved to a type Pin
Richard MacCutchan29-Jan-15 23:06
mveRichard MacCutchan29-Jan-15 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.