Thursday, 26 March 2015

Pyramid shape using loop



#include<stdio.h>
int main()
{
 int n;
 printf("enter your line number: \n");
 scanf("%d",&n);

 for(int i=1;i<=n;i++)
 {
  for(int j=i;j<=n;j++)
  {
   printf(" ");
  }
  for(int k=1;k<2*i;k++)
  {
   printf("*");
  }
  printf("\n");
 }
 return 0;
}

0 comments:

Post a Comment

 

Subscribe to our Newsletter

Contact our Support

Through the contact form

Our Team Memebers