patter like
n=2
*
* *
* * *
* * * *
* * *
* *
*
pls help me in solve this program
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");
}
}
generlize this above program for n number
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()
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.