This discussion is archived
3 Replies Latest reply: Mar 13, 2008 6:09 PM by 807591

# Help with problem implementing Gauss type algorithm

Currently Being Moderated
I'm working on a Project for my class and am writing the code for one of Methods in my EasterClass which is the programmer class. The program is supposed to compute the d I found the remainder method of in standard class library as the directions state I need to get the remainder of the divisions i have to do and assign them to variables. Now my question is, how do I get the quotient value to be a whole number? Like this example 7/5 gives you a quotient of 1 with remainder 2 how do I get just the quotient value without the remainder. It's probably something simple that I'm not getting .
Answers would be great as I just need this clarified to continue coding.

Troy
• ###### 1. Re: Help with problem implementing Gauss type algorithm
Currently Being Moderated
I think what you need to do is simple int division. For instance:
``int result = 7/5; ``
will give a result of 1

whereas
``````double doubleResult1 = 7.0/5;
double doubleResult2 = (double)7/5; ``````
will give results of 1.4
• ###### 2. Re: Help with problem implementing Gauss type algorithm
Currently Being Moderated
Figured it was something simple, the teacher said the variable should be of double type, but I guess I'll check and see if I can use int type.

thanks
• ###### 3. Re: Help with problem implementing Gauss type algorithm
Currently Being Moderated
ptroy wrote:
Figured it was something simple, the teacher said the variable should be of double type, but I guess I'll check and see if I can use int type.
And so you can. I don't have a compiler handy, but I imagine that if you do this:
``double result = 7/5;``
my guess is you'll get a double variable that holds 1.0. But I'm not 100% sure here. Best to play around with this, test different variations out.