Click here to Skip to main content
14,695,085 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
#include<stdio.h>
int main()
{
      int i,j,n, a=1;
      printf("How Many Lines \nYou Want to Print: ");
      scanf("%d",&n);
      for(i=n;i>=1;i--)
      {
            for(j=1;j<=i;j++)
            {
                  printf("%d  ",a);
                
            }
             a=a+2;
            printf("\n");
      }
      return 0;
}


What I have tried:

<?php
for($i=1;$i<=4;$i++)
{
	for($j=1;$j<=(1+$i);$j++)
	{
	echo $j." ";
	}
	echo"<br>";
}
?>
Posted
Updated 22-Sep-20 17:33pm
v2
Comments
Patrice T 3-Mar-19 14:10pm
   
And you have a question ?

1 solution

Read the C code a little more carefully.
What does it print inside the loops, and when does that get modified?
Is that the same as your code?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900