patter like
n=2

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

pls help me in solve this program

Recommended Answers

All 3 Replies

I am new here ,here is my code:

#include "stdio.h"
main()
{
	int i, j;
	for(i= 0; i<4; i++)	
	{
		for(int k= 6-2*i; k>0; k--)
		{
			printf(" ");
		}
		for(j= i+1; j>0; j--)
			printf("*   ");
		printf("\n");
	}
	
	for(i= 3; i>0; i--)	
	{
		for(int k= 8-2*i; k>0; k--)
			printf(" ");
		for(j= i; j>0; j--)
			printf("*   ");
		printf("\n");
	}
}
commented: good job dude +0
commented: Then you should read the forum rules about not spoon-feeding answers to people who show no effort -3

generlize this above program for n number

commented: You generalise it you lazy ass -3
commented: See Salem's post +0
commented: *cough* -1

First of all meghs, your pattern is not properly indented, it should be

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

Second, you should have shown us how much you have tried. Let your code be full of errors, we'll point out your errors. But don't expect fully fledged answers for you to copy-paste. It is against the spirit of learning

Third, lostfate, you shouldn't have given out the answer just like that. Help him/her to understand the nature of the problem. At least someones brain neurons would have been tickled.

Forth, lostfate, please follow the standard coding practices, that is, int main() (with return ) and not just main()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.