public class Kumite { public static boolean IsThree(int x) { while(x > 0) { if(x % 10 == 3) return true; x /= 10; } return false; } }
- public class Kumite {
public static bool IsThree(int x) =>x.ToString().Contains('3');- public static boolean IsThree(int x) {
- while(x > 0) {
- if(x % 10 == 3)
- return true;
- x /= 10;
- }
- return false;
- }
- }
import junit.framework.*; public class JavaTest extends TestCase { public void tests() { assertFalse(Kumite.IsThree(525458)); assertFalse(Kumite.IsThree(2222)); assertTrue(Kumite.IsThree(354523)); assertTrue(Kumite.IsThree(748504231)); } }
using NUnit.Framework;- import junit.framework.*;
namespace Tests {[TestFixture]class TestsClass {[Test]public void Tests() {Assert.IsFalse(Kumite.IsThree(525458));Assert.IsFalse(Kumite.IsThree(2222));- public class JavaTest extends TestCase {
- public void tests() {
- assertFalse(Kumite.IsThree(525458));
- assertFalse(Kumite.IsThree(2222));
Assert.IsTrue(Kumite.IsThree(354523));Assert.IsTrue(Kumite.IsThree(748504231));- assertTrue(Kumite.IsThree(354523));
- assertTrue(Kumite.IsThree(748504231));
- }
}- }