//This Java program accepts 10 integers and stores them in an
//array and then first prints the negative integers and
//then the positive integers in the way they are present in
//the array.
import java.util.*;
class separate
{
public static void main(String Srgs[])
{
System.out.println("Enter 10 numbers");
int a[]=new int[10];
Scanner sc=new Scanner(System.in);
int i;
for(i=0;i<10;i++)
{
a[i]=sc.nextInt();
}
System.out.println("The new Sorted Array is :-");
for(i=0;i<10;i++)
{
if(a[i]<0)
{
System.out.println(a[i]);
}
}
for(i=0;i<10;i++)
{
if(a[i]>0)
{
System.out.println(a[i]);
}
}
}
}
//Author : Mayank Rajoria
//array and then first prints the negative integers and
//then the positive integers in the way they are present in
//the array.
import java.util.*;
class separate
{
public static void main(String Srgs[])
{
System.out.println("Enter 10 numbers");
int a[]=new int[10];
Scanner sc=new Scanner(System.in);
int i;
for(i=0;i<10;i++)
{
a[i]=sc.nextInt();
}
System.out.println("The new Sorted Array is :-");
for(i=0;i<10;i++)
{
if(a[i]<0)
{
System.out.println(a[i]);
}
}
for(i=0;i<10;i++)
{
if(a[i]>0)
{
System.out.println(a[i]);
}
}
}
}
//Author : Mayank Rajoria
No comments:
Post a Comment