Squaring a number is multiplying it by itself . in this kata We Will not use the multiplication Operator or Even the Built-in POw Function .
sample input_output ::
3 >- 9
4 >- 16
5 >- 25
hint :
observe this kata Tags (Reveal EverThing ) !!
int sqauring (int num)
{
int times ;
times = num ;
int squared ;
squared = 0;
for (int i = 0 ; i <times ; i++ )
{
squared = squared + num ;
}
return squared ;
}
// TODO: Replace examples and use TDD development by writing your own tests
Describe(any_group_name_you_want)
{
It(should_do_something)
{
Assert::That(3, Equals(9));
Assert::That (4, Equals(16));
Assert::That(5, Equals(25));
}
};
Array and looping are in old-love story . Tonight we gonna play the game by separae them . given integer array , we want to sort it without the use of any kind of arrays .
Hint ::
You can write it in one line - Code
def sortinggggggggggg (arr) :
Soreteddddd = sorted (arr)
return Soreteddddd
sortinggggggggggg ([2,0,25,3])
# TODO: Replace examples and use TDD development by writing your own tests
# These are some of the methods available:
# test.expect(boolean, [optional] message)
# test.assert_equals(actual, expected, [optional] message)
# test.assert_not_equals(actual, expected, [optional] message)
# You can use Test.describe and Test.it to write BDD style test groupings