0
import java.util.*;
class Array
{
    Scanner in()
    {   return new Scanner(System.in);  }

    void out(String n)
    {   System.out.print(n);    }

    int[] getarray(int n)
    {
        int a[]=new int[n];
        for(int i=0;i<a.length;i++)
        {
            out("Enter A["+i+"]: ");
            a[i]=in().nextInt();
        }
        return a;
    }

    void showarray(int[] a)
    {
        for(int c:a)
            out("Array: " +c);
        out("\n");
    }

    void sortinc(int[] a,int n)
    {
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
                if(a[i]>a[j])
                {
                    int temp=a[i];
                    a[i]=a[j];
                    a[j]=temp;
                }
    }

    void sortdec(int[] a,int n)
    {
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
                if(a[i]<a[j])
                {
                    int temp=a[i];
                    a[i]=a[j];
                    a[j]=temp;
                }
    }

    int sum(int[] a,int n)
    {
        int s=0;
        for(int i=0;i<n;i++)
            s+=a[i];
        return s;
    }

    int search(int[] a,int n)
    {
        int s;
        out("Enter your value to search: ");
        s=in().nextInt();
        for(int i=0;i<n;i++)
        {
            if(s==a[i])
                s=a[i];
            else
                out("Search not found.");
        }
        return s;
    }

    public Array()
    {
        int n;
        out("Enter Value N: ");
        n=in().nextInt();
        int[] a=new int[n];
        a=getarray(n);
        showarray(a);
    }

    public static void main(String[] args)
    {   new Array();    }
}

Edited by Reverend Jim: Fixed formatting

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by zeeven
0

Please edit your post with in 30 minutes and add code tags [code] YOUR CODE HERE [/code]
Secondly some problem description or any error messages would be beneficial (do not expect everyone to try copy&paste to run your application)

0

site the error code, and what is the goal of the program? don't let the readers to do the compilation

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.