The Artima Developer Community
Sponsored Link

Java Answers Forum
Hw to add two no's without + sign

5 replies on 1 page. Most recent reply: Aug 18, 2006 12:30 AM by joe smith

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
ravi kumar

Posts: 1
Nickname: sravik
Registered: Aug, 2006

Hw to add two no's without + sign Posted: Aug 14, 2006 9:18 AM
Reply to this message Reply
Advertisement
Hi sir,

I have one doubt in Java.How can we add two numbers without using plus(+) sign in Java/C/C++..


Thank You.


Dave Hinton

Posts: 42
Nickname: catbells
Registered: Oct, 2003

Re: Hw to add two no's without + sign Posted: Aug 15, 2006 4:55 AM
Reply to this message Reply
Why would you want to?

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Hw to add two no's without + sign Posted: Aug 15, 2006 5:51 AM
Reply to this message Reply
> Why would you want to?

Presumably because that's what the exercise asked...

How about:
z = x - -y;
Not exactly difficult, was it?

joe smith

Posts: 21
Nickname: jetbrains
Registered: Jan, 2006

Re: Hw to add two no's without + sign Posted: Aug 16, 2006 5:30 AM
Reply to this message Reply
Give you an example

a+b=c;

Create an ArrayList list, first insert a objects, then insert b objects. c=list.size();
We don't use plus(+)sign at all

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Hw to add two no's without + sign Posted: Aug 16, 2006 10:19 AM
Reply to this message Reply
> Create an ArrayList list, first insert a objects, then
> insert b objects. c=list.size();
> We don't use plus(+)sign at all

What if a and b were negative?

joe smith

Posts: 21
Nickname: jetbrains
Registered: Jan, 2006

Re: Hw to add two no's without + sign Posted: Aug 18, 2006 12:30 AM
Reply to this message Reply
Good question.In fact I can do with negative by arraylist,
but it's hard to do with float and double.
http://www.developerzone.biz/

Flat View: This topic has 5 replies on 1 page
Topic: Discrepancy in Rounding the numbers Previous Topic   Next Topic Topic: PAM & Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use