C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28691
Number of posts: 94711

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Pattern in C Posted by amithinduja on 12 Jan 2009 at 12:10 PM
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.


   1
  232
 34543
4567654


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
Report
Re: Pattern in C Posted by Lundin on 12 Jan 2009 at 12:52 PM
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.
Report
Re: Pattern in C Posted by DevendraJoshi on 22 Jun 2010 at 5:11 AM
#include<stdio.h>
#include<conio.h>
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("\n");
}
getch();
}



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.