Ask your Question

PEOPLE YOU MIGHT KNOW

Mansi
Mansi

One stop solution for all digital marketing needs!

West Chester,  United States
Impressico
Impressico

New York,  United States
Vpro
Vpro

Vpro Infotech

Ludhiana,  India
Eecrets
Eecrets

MAGENTO CUSTOMIZATION. DEVELOPMENT AND INTEGRATIONS

Varanasi,  India
Wedding
Wedding

Wedding Limo Services Company in Toronto

ON,  Canada

Write to us

Ask Question

how do we print square of numbers

How do we print square of numbers that is 1,4,9,16,25 and so on using php please reply thank you.

0   0
anees  fatima
profile little 4th September 2018

<?php

function findSquare($start,$end){

/* 1. Range will give you all

the numbers in between start and end.

2. The inbuilt function array_map will loop

through each element of that array and do the multiplication

*/

array_map(function($n){

echo ($n*$n).' ';

},range($start,$end));

}

$start = 1;

$end = 10;

findSquare($start,$end);

?>

Ranjeet
17-10-2018 00:00

Thanks, it's working

Write a comment ...
Post comment
Cancel

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site