C Program to Generate Numbers in Pyramid Pattern
Submitted by Srikanth on Friday, 7 December 200710 Comments
This C program generates the numbers in pyramid pattern. It takes the input from two through nine and generates the numbers in the pyramid pattern. For example if the input is 4 then the program produces the following output
…
….1
1111112 2
111113 3 3
111.4 4 4 4 & so on..
CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,j,x=40,y=10;
clrscr();
printf(“Enter n (between 2 & 9)\n”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
gotoxy(x,y); /* To take the cursor to the co-ordinates x & y */
for(j=1;j<=i;j++)
{
printf(“%d “,i);
}
x=x-1;
y++;
}
getch();
}
#include<conio.h>
void main()
{
int i,n,j,x=40,y=10;
clrscr();
printf(“Enter n (between 2 & 9)\n”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
gotoxy(x,y); /* To take the cursor to the co-ordinates x & y */
for(j=1;j<=i;j++)
{
printf(“%d “,i);
}
x=x-1;
y++;
}
getch();
}
Popularity: 2% [?]
By using/following this site you agree to our Legal Disclaimer


Srikant, plz tell me how to connect access or sql as backend with c or c++ as frontend
i want to c program logic
it’s output will display like that:-
*
* *
* *
* *
* *
* * * * * *
this type of output o want so plz help me…..
hi!srikanth,how to generate the following:
U
U N
U N I
U N I X
U N I X
U N I
U N
U
i want to print a pattern like
*
**
***
****
in c++
could neone help me please..
i want to print a pattern like
1
2 3
3 4 5
6 7 8 9 10
hey can you send me the program for this output:
using nested for loop
A
AB
ABC
ABCD
self explanatory program!
pls, can u make a program that prints this:
0
01
012
0123
01234
0123
012
01
0
#include
#include
void main()
{
char ch=’A'-1;
int i,j,n=4;
clrscr();
for(i=1;i<=4;++i)
{
for(j=1;j<=i;++j)
{
printf("%c",ch+1);
}
printf("\n");
}
getch();
}
I want to print Pyramidal Program. Like this
*
* *
* * *
* * * * and so on.
Leave your response!
EMAIL SECURITY »
What to Do When Your Email Account is Hacked?
How to Recover Hacked Email Accounts?
It can be a real nightmare if someone hacks and takes control of your email account as it may contain confidential information like bank logins, credit card details and other sensitive data. …
HOW STUFFS WORK »
How Antivirus Software Works
Due to ever increasing threat from virus and other malicious programs, almost every computer today comes with a pre-installed antivirus software on it. In fact, an antivirus has become one of the most essential software package for every computer. Even though every one …
HOW-TO GUIDES »
How to Hide Data in Image, Audio & Video Files: Steganography
Ever wondered to know how to hide secret messages in images, audio and video files? Well, in this post I will take you through a concept called steganography using which, it is possible to hide your secret information …
INTERNET SECURITY »
How to Hide Data in Image, Audio & Video Files: Steganography
Ever wondered to know how to hide secret messages in images, audio and video files? Well, in this post I will take you through a concept called steganography using which, it is possible to hide your secret information …
NETWORK HACKS »
How to Hack an Ethernet ADSL Router
Almost half of the Internet users across the globe use ADSL routers/modems to connect to the Internet however, most of them are unaware of the fact that it has a serious vulnerability which can easily be exploited even by a …
Categories
Most Popular
Most Commented
Blogroll
Log In | Entries (RSS) | Comments (RSS) | Sitemap
© 2008-2011 GoHacking.Com. This content is copyrighted to Srikanth and may not be reproduced on other websites.