Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By doWhile

Thread: addition

  1. #1
    rithish is offline Member
    Join Date
    Apr 2011
    Posts
    40
    Rep Power
    0

    Default addition

    Java Code:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    class factorial
    {
    	public static void main(String args[])throws IOException
    	{
    		factorial f=new factorial();
    		int c;
    		InputStreamReader ins=new InputStreamReader(System.in);
    		BufferedReader br=new BufferedReader(ins);
    		System.out.println("enter the value of a");
    		String x=br.readLine();
    		int a=Integer.parseInt(x);
    		System.out.println("enter the value of b");
    		String y=br.readLine();
    		Integer.parseInt(y);
    		f.add(a,b);
    		
    	}
    	
    	class add
    	{
    		int c;
    	
    		add(int a,int b)
    		{
    			c=a+b;
    			System.out.println("c");
    		}
    	}
    }

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: addition

    ...and your question is what...
    sunde887 likes this.

  3. #3
    rithish is offline Member
    Join Date
    Apr 2011
    Posts
    40
    Rep Power
    0

    Default Re: addition

    i didnt get output what is the mistake in the programme

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: addition

    We don't know what you were expecting as the output. Provide details. What should happen? What does happen? What have you tried to fix it? Why do you think it doesn't work? etc.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default Re: addition

    Quote Originally Posted by rithish View Post
    Java Code:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    class factorial
    {
    	public static void main(String args[])throws IOException
    	{
    		factorial f=new factorial();
    		int c;
    		InputStreamReader ins=new InputStreamReader(System.in);
    		BufferedReader br=new BufferedReader(ins);
    		System.out.println("enter the value of a");
    		String x=br.readLine();
    		int a=Integer.parseInt(x);
    		System.out.println("enter the value of b");
    		String y=br.readLine();
    		Integer.parseInt(y);
    		f.add(a,b);
    		
    	}
    	
    	class add
    	{
    		int c;
    	
    		add(int a,int b)
    		{
    			c=a+b;
    			System.out.println("c");
    		}
    	}
    }
    Does your code compile? If not, what had your compiler to say about it?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. addition problems
    By soccer_kid_6 in forum New To Java
    Replies: 4
    Last Post: 09-21-2010, 08:11 PM
  2. Addition of Two time
    By jithan in forum New To Java
    Replies: 5
    Last Post: 12-29-2008, 12:09 PM
  3. Addition Problem
    By tornado in forum New To Java
    Replies: 6
    Last Post: 12-07-2008, 12:37 AM
  4. string addition??
    By j2vdk in forum New To Java
    Replies: 2
    Last Post: 09-03-2008, 04:41 PM
  5. Binary Addition
    By Deo Favente in forum Advanced Java
    Replies: 11
    Last Post: 04-24-2008, 06:34 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
  •