Add two numbers using a Single Variable!

N

nirjhar.oberoi

Hi,

This is my first post on this group! i am beginner lever C programmer.
I am trying to add two numbers or multiply them using a single
variable!
Your are not allowed to use Unions or any other userdefined DS!

Inline assembly is accepted! but use only "One Variable"

Thanks

waiting for replies!
 
W

Walter Roberson

This is my first post on this group! i am beginner lever C programmer.
I am trying to add two numbers or multiply them using a single
variable!
Your are not allowed to use Unions or any other userdefined DS!
Inline assembly is accepted! but use only "One Variable"

That's somewhat tricky in that you would normally need to
read the values into distinct variables in order to be able to
add them. However, you could probably do something with
recursion; then you would be limited by the stack size.
 
G

Guest

Hi,

This is my first post on this group! i am beginner lever C programmer.
I am trying to add two numbers or multiply them using a single
variable!
Your are not allowed to use Unions or any other userdefined DS!

Inline assembly is accepted! but use only "One Variable"

If inline assembly is part of the intended solution, this is the wrong
place to post. There is no such thing as inline assembly in standard C,
and inline assembly as an extension has different syntax even for
different compilers for the same system, let alone different compilers
for different systems.

By the way: it appears you are allowed to use an array of int as your
one variable: you can use arrays without defining anything other than a
variable, so there's no problem with user-defined "DS" (data
structures, I guess?). Just read the first value into array[0], the
second into array[1], and add and multiply as usual. If you can't do
this, you asked the wrong question. If the question isn't yours, maybe
you should have said so and show what you have tried so far.
 
J

Joe Wright

Hi,

This is my first post on this group! i am beginner lever C programmer.
I am trying to add two numbers or multiply them using a single
variable!
Your are not allowed to use Unions or any other userdefined DS!

Inline assembly is accepted! but use only "One Variable"

Thanks

waiting for replies!
Summer school? What do you find difficult?

int a = 2 + 3;
 
R

Ronald Bruck

Hi,

This is my first post on this group! i am beginner lever C programmer.
I am trying to add two numbers or multiply them using a single
variable!
Your are not allowed to use Unions or any other userdefined DS!

Inline assembly is accepted! but use only "One Variable"

Thanks

waiting for replies!

A long time, I trust.

"Your are not allowed...Inline assembly is accepted"!

Do your own homework.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top