I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » C/C++ »

Help!! Program that can display the following pattern

Iceman\′s Photo
23 Sep 07, 4:16AM
(2 replies)
Help!! Program that can display the following pattern
guys plz help me on this.........

i need a program that can display the follwing pattern

* ** *** ****

where *=n, and n is to be accepted from user.

if n=5 Input=5

then the stars should displayed till

* ** *** **** *****

Thanks in ADVANCEEEEEEEEEEE :D

will\′s Photo
27 Sep 07, 9:14AM
#include <stdio.h>
void triangle(int N)
{
  for(int i=0;i<N;i++)
  {
    putchar('\n');
    for(j=0;j<i;j++) putchar('*');
  }
}
 
int main()
{
  triangle(5);
}

That should do it. I'm sure you can figure out how to get user input for the numer N. Try scanf!

W

Iceman\′s Photo
15 Oct 07, 9:01AM
hey thanks will!!

Will i will try it out :wink: :D
Currently you need to be logged in to leave a message.