makes10

Given 2 ints, a and b, return true if one if them is 10 or if their sum is 10.

makes10(9, 10) -> true
makes10(9, 9) ->false
makes10(1, 9) -> true

public boolean makes10(int a, int b) {
if( a ==10 || b==10) return true;
else if((a+b)==10) return true;
else return false;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s