Ad

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 ;
}
Code
Diff
  • def sortinggggggggggg (arr) :
      Soreteddddd = sorted (arr)
      print (Soreteddddd)
      return Soreteddddd
    sortinggggggggggg ([2,0,25,3])
    
    • def sortinggggggggggg (arr) :
    • Soreteddddd = sorted (arr)
    • print (Soreteddddd)
    • return Soreteddddd
    • sortinggggggggggg ([2,0,25,3])

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])