Results 1 to 2 of 2
  1. #1
    florida is offline Member
    Join Date
    Mar 2013
    Posts
    13
    Rep Power
    0

    Question help me to get output

    help me to get the output.it doesn't shows any output. it just read the values....


    class digit
    {
    public static void main(String args[])
    {
    DataInputStream in = new DataInputStream(System.in);
    int n;
    prog1 p = new prog1();
    try
    {
    System.out.println("enter the array size");
    n=Integer.parseInt(in.readLine());
    int a[]= new int[n];
    for(int i=0;i<=n;i++)
    {
    System.out.println("enter the element");
    a[i]=Integer.parseInt(in.readLine());
    }
    p.cal (a,n);
    }
    catch (Exception e){ }
    }
    }
    class prog1
    {
    int c=0;
    void cal(int x[], int y)
    {
    for(int i =0;i<=y;i++)

    {
    if(x[i]>=100 && x[i]<=200)
    {
    if((x[i]%7)==0)
    {
    c+=x[i];
    }
    }
    }

    System.out.println("the value is"+ c);
    }
    }


    D:\bharathi\Java2\jdk1.6.0_33\bin>java digit
    enter the array size
    2
    enter the element
    109
    enter the element
    114
    enter the element
    112

    D:\bharathi\Java2\jdk1.6.0_33\bin>

    help me ........
    thank u in advance

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: help me to get output

    You already asked this question in your previous thread: to fix the error " .class expected"
    Please don't double post; I'm closing this thread.

    kind regards,

    Jos

    ps. and please use the code tags
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 2
    Last Post: 05-03-2012, 12:39 PM
  2. please help - don't see the right output?
    By Zahara in forum New To Java
    Replies: 5
    Last Post: 02-24-2012, 12:41 PM
  3. Replies: 0
    Last Post: 09-30-2010, 09:16 PM
  4. NaN output?
    By bigj in forum New To Java
    Replies: 2
    Last Post: 01-06-2010, 10:32 AM
  5. Java, output string, getting correct output? HELP!
    By computerboyo in forum New To Java
    Replies: 2
    Last Post: 02-26-2009, 12:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •