Ask your Question

PEOPLE YOU MIGHT KNOW

Pooja
Pooja

Chiplun,  India
Everest Educational
Everest Educational

Visa Consultants in Punjab

Ludhiana,  India
Vikas
Vikas

Web developer

Gurgaon,  India
Space
Space

Courier Services

Birmingham,  United Kingdom
MobileComm
MobileComm

MobileComm Professionals Inc.

Richardson,  United States

Write to us

Ask Question

how do we print square of numbers

anees  fatima

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

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