Print squares of first n natural numbers without using * , / and | PHP program to print squares of first ' n ' natural numbers wothout using * , / and - ; Initialize ' square ' and first odd number ; Calculate and print squares ; Print square ; Update ' square ' and ' odd ' ; Driver Code
< ? php function printSquares ( $ n ) { $ square = 0 ; $ odd = 1 ; for ( $ x = 0 ; $ x < $ n ; $ x ++ ) { echo $ square , " " ; $ square = $ square + $ odd ; $ odd = $ odd + 2 ; } } $ n = 5 ; printSquares ( $ n ) ; ? >