473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Addition program

i want Java program for additin of two numbers with out using any Arithemetic operator.
Sep 14 '07 #1
13 5163
r035198x
13,262 8TB
i want Java program for additin of two numbers with out using any Arithemetic operator.
We can't help you cheat by doing your homework for you.
Sep 14 '07 #2
JosAH
11,448 Expert 8TB
i want Java program for additin of two numbers with out using any Arithemetic operator.
Why do you want such a program; I mean it will be highly inefficient compared
to a simple '+' operator.

kind regards,

Jos
Sep 14 '07 #3
r035198x
13,262 8TB
Why do you want such a program; I mean it will be highly inefficient compared
to a simple '+' operator.

kind regards,

Jos

And the program doesn't even teach as much Java as you would want your students to learn from an assignment if you were a teacher.
Sep 14 '07 #4
JosAH
11,448 Expert 8TB
And the program doesn't even teach as much Java as you would want your students to learn from an assignment if you were a teacher.
True, teachers either like to freak with bits or they come up with assignments
using Swing components before the students can even design a couple of decent
classes. Or the ever boring CD inventory program of course ;-)

kind regards,

Jos
Sep 14 '07 #5
Ganon11
3,652 Expert 2GB
True, teachers either like to freak with bits or they come up with assignments
using Swing components before the students can even design a couple of decent
classes. Or the ever boring CD inventory program of course ;-)

kind regards,

Jos
Don't forget Rational numbers.

I have a feeling that if I take a Java class here at college, I'll come across the same problem.
Sep 14 '07 #6
Nepomuk
3,112 Expert 2GB
Don't forget Rational numbers.

I have a feeling that if I take a Java class here at college, I'll come across the same problem.
If you want to add rational (or real or even complex) numbers, you must still use the '+' operator or an alternative, which is capable of adding integers / doubles. Just have to write a bit more code.

There's a wonderful quote: "God created the positive integers. Everything else was created by man."

Greetings,
Nepomuk
Sep 14 '07 #7
JosAH
11,448 Expert 8TB
There's a wonderful quote: "God created the positive integers. Everything else was created by man."
I like the following corollary: "zero, one, more". Where 'more' may include
integral numbers, rational numbers, real (IEE) numbers, complex numbers,
quaternions and even the number three.

kind regards,

Jos ;-)
Sep 14 '07 #8
Nepomuk
3,112 Expert 2GB
I like the following corollary: "zero, one, more". Where 'more' may include
integral numbers, rational numbers, real (IEE) numbers, complex numbers,
quaternions and even the number three.

kind regards,

Jos ;-)
Well, zeros and ones are certainly anything a computer (and a mathematician, who goes back to the basics) needs... ^^

Greetings,
Nepomuk
Sep 14 '07 #9
JosAH
11,448 Expert 8TB
Well, zeros and ones are certainly anything a computer (and a mathematician, who goes back to the basics) needs... ^^

Greetings,
Nepomuk
Duh, you CS guys always overcomplicate things; us math type of folks only
need an idempotent element and a successor function.

kind regards,

Jos ;-)
Sep 14 '07 #10
r035198x
13,262 8TB
Duh, you CS guys always overcomplicate things; us math type of folks only
need an idempotent element and a successor function.

kind regards,

Jos ;-)
And a few ridiculous axioms ...
Sep 14 '07 #11
Nepomuk
3,112 Expert 2GB
Duh, you CS guys always overcomplicate things; us math type of folks only
need an idempotent element and a successor function.

kind regards,

Jos ;-)
Well, actually I'm also a math guy, but you will need neutral elements (0 and 1 ARE idempotent elements by the way, at least within the complex numbers and any subset of those) and, as r035198x pointed out, a few axioms. Just imagine, you couldn't expect "a + b = b + a"! (And yes, I do know, that you get such constructs, but they aren't much use in anything the OP might want to do, are they?)

Greetings,
Nepomuk
Sep 14 '07 #12
JosAH
11,448 Expert 8TB
Well, actually I'm also a math guy, but you will need neutral elements (0 and 1 ARE idempotent elements by the way, at least within the complex numbers and any subset of those) and, as r035198x pointed out, a few axioms. Just imagine, you couldn't expect "a + b = b + a"! (And yes, I do know, that you get such constructs, but they aren't much use in anything the OP might want to do, are they?)

Greetings,
Nepomuk
Quick! Defenestrate this man! He's overcomplicating things again by
re-rejargoning simple things! Help! Help! I'm being oppressed! Help!

kind regards,

Jos ;-)
Sep 14 '07 #13
Nepomuk
3,112 Expert 2GB
Quick! Defenestrate this man! He's overcomplicating things again by
re-rejargoning simple things! Help! Help! I'm being oppressed! Help!

kind regards,

Jos ;-)
I'm not overcomplicating things, I'm just going back to the basics.

But hey, I managed to oppress JosAH? Wow, that makes me feel really good! ;-)

Feeling very much defenestrated,
Nepomuk
Sep 14 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Zack Wahab | last post by:
Hi, I use Dev C++ compiler. Tried this program : // Fig. 1.6: fig01_06.cpp // Addition program. #include <iostream> // function main begins program execution int main()
2
by: akickdoe22 | last post by:
i could really use help finishing this addition program. I'm stuck on the part that allows you to add any two large integers,up to 100 digits,(pos+pos, neg+neg, and pos+neg). could use hints ideas...
24
by: Alex Vinokur | last post by:
Consider the following statement: n+i, where i = 1 or 0. Is there more fast method for computing n+i than direct computing that sum? -- Alex Vinokur email: alex DOT vinokur AT gmail DOT...
5
by: snow.carriers | last post by:
(This is personal work by the way, I took the questions from sites to enhance my c++ at start before I go indepth) A program will ask 10 questions in addition. If they get it wrong, they get...
34
by: Andy | last post by:
Hi, Are 1 through 4 defined behaviors in C? unsigned short i; unsigned long li; /* 32-bit wide */ 1. i = 65535 + 3; 2. i = 1 - 3; 3. li = (unsigned long)0xFFFFFFFF + 3; 4. li = 1...
2
by: confusedKaran | last post by:
Hi, I am currently making a program which can add and multiply two numbers with infinite amount of digits. The addition part of it I did by taking the input as a string and then one by one addiing...
5
by: Mike | last post by:
Hello All, Please, if anyone can point me to the problem, I'd sure appreciate it! I am very new to VB programming and not a programmer to begin with. This is part of a Visual Basic 2005 Express...
2
by: hamady2001 | last post by:
Hello everyone this is my first post and I just started my Python class. I am stuck on an assignment...please help I have to redo the below program (from a prior assignment) to include 2 functions...
4
by: thirusvga | last post by:
please send addition program....
2
by: susheela s | last post by:
i wrote a program to add bytes in array in such a way that when i add zeroth byte of two array sum should retained and carry must be added to next addition of bytes(ie array index 1 bytes) this is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.