PHP Professional এবং Zend Certified PHP Engineer (ZCPE ) Course এ সীমিত সংখ্যক আসন বাকি আছে। আগ্রহীদেরকে অতিসত্বর মাসুদ আলম স্যার এর সাথে যোগাযোগ করার জন্য অনুরোধ করা যাচ্ছে। স্যার এর মোবাইল নম্বর : ০১৭২২ ৮১ ৭৫ ৯১

Staircase, Algorithm

Consider a staircase of size :

   #
  ##
 ###
####

Observe that its base and height are both equal to , and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.

Write a program that prints a staircase of size .

Input Format

A single integer, , denoting the size of the staircase.

Output Format

Print a staircase of size using # symbols and spaces.

Note: The last line must have spaces in it.

Sample Input

6 

Sample Output

     #
    ##
   ###
  ####
 #####
######

Explanation

The staircase is right-aligned, composed of # symbols and spaces, and has a height and width of .

</div>
<div class="challenge-sidebar-container"></div>
<div class="challenge-sidebar-container"><?php

$handle = fopen ("php://stdin","r");
fscanf($handle,"%d",$n);


for ($i=0; $i < $n; $i++) {
for ($j=0; $j < $n; $j++) {
if ($j>=$n-1-$i) {
echo '#';
}else{
echo " ";
}
}
echo "\n";
}


?></div>
<div class="challenge-sidebar-container"></div>
<div class="challenge-sidebar-container">

I am PHP problem solver at Hackerrank. I am preparing myself for PHP zend certification exam with Masud Alam sir.
I have completed few websites using LARAVEL, also have experience on WORDPRESS.

Leave a Reply

Your email address will not be published. Required fields are marked *