Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		
- 
				
				 stacked26288ypublic int gcd( int a, int b ) { stacked26288ypublic int gcd( int a, int b ) {
 if ( a < 0 )
 return gcd( -1 * a, b );
 if ( b < 0 )
 return gcd( a, -1 * b );
 if ( a > b )
 return gcd( a - b, b );
 if ( a < b )
 return gcd( a, b - a );
 return a;
 }
 
 public boolean even( int num ) {
 if ( gcd( num, 2 ) == 2 )
 return true;
 else
 return false;
 }
- 
				
				 Navigatr8948yI'm so confused as to what this code is even supposed to do. Is it trying to determine whether or not an integer is an even number? :S Navigatr8948yI'm so confused as to what this code is even supposed to do. Is it trying to determine whether or not an integer is an even number? :S
- 
				
				 Navigatr8948y@DefiniteGoose Couldn't you just: Navigatr8948y@DefiniteGoose Couldn't you just:
 
 public bool even(int number) {
 
 return (number % 2 == 0);
 
 }
 
 (Note: I'm not familiar with Java, which is what I assume this is.)
- 
				
				 sallai1828y@inaba Thanks! I've seen it a lot of times but never actually found out what it's called :) sallai1828y@inaba Thanks! I've seen it a lot of times but never actually found out what it's called :)
 
 ++'d
 
 </offtopic>
Related Rants
- 
						
							 l0om43 l0om43 100% Real. And it's not even the worst on the site. 100% Real. And it's not even the worst on the site.
- 
						
							 Codazed11Being 100% serious, I saw a guy in my Computer Programming I class using MS Word to write code that he would c... Codazed11Being 100% serious, I saw a guy in my Computer Programming I class using MS Word to write code that he would c...
- 
						
							 dfox8I worked with a good dev at one of my previous jobs, but one of his faults was that he was a bit scattered and... dfox8I worked with a good dev at one of my previous jobs, but one of his faults was that he was a bit scattered and...











public boolean even( int num ) {
if ( num < 0 )
num = -1 * num;
while ( num > 1 )
num = num - 2;
if ( num == 0 )
return true;
else
return false;
}
rant
wk99