Wednesday, October 19, 2011

Write a program that will display the following pattern, give the value n

#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf

main()
{
      int a,b,num;
      p("Enter a number:");
      s("%d",&num);
    
      for(a=1; a < num+1; a++)
      {
               for (b=0; b < a; b++)
               p("*");
               p("\n",a);
      }
      getch();
      return 0;
}

No comments:

Post a Comment