Pattern in C - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Pattern in C

amithindujaamithinduja Posts: 7Member
Hey again I am posing an easy thing at Programmers Heaven. This may also be a cakewalk for all here. I need a pattern as printed below. Kindly post it fast as I need it as early as possible.


[code]
1
232
34543
4567654
[/code]

This is for input parameter 7.

Another thing I need the output using only loops. Not direct printing.

I need the solution as early as possible
Thanks in advance
ProgrammersHeaven Rocks

Regards
Amit Hinduja

Comments

  • LundinLundin Posts: 3,711Member
    Yes it is a cakewalk, but code begging without any effort made by the original poster is also against the posting policies. Please ask a specific question or post the code you are having trouble with.
  • DevendraJoshiDevendraJoshi Posts: 1Member
    #include
    #include
    void main()
    {
    int i,j,k,n;
    int a=0;
    printf("Enter the odd no to get the series");
    scanf("%d",&n);
    n=(n+1)/2;
    for(i=1;i<=n;i++)
    {
    for(k=1;k<=n-i;k++)
    {
    printf(" ");
    }
    a=i;
    for(j=1;j<=i;j++)
    {
    printf("%d",a);
    a=a+1;
    }
    a--;
    for(j=1;j<i;j++)
    {
    a=a-1;
    printf("%d",a);
    }
    printf("
    ");
    }
    getch();
    }
Sign In or Register to comment.