C Program to Generate Numbers in Pyramid Pattern
Submitted by Srikanth on Friday, 7 December 20073 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: 1% [?]
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
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-TO GUIDES »
How to Detect Anonymous IP Addresses
As the fraudsters are now becoming more sophisticated in bypassing the Geo-location controls by using proxies (Anonymous IPs) to spoof their IP address, it has become very much necessary to come up with a means …
INTERNET SECURITY »
How to Detect Anonymous IP Addresses
As the fraudsters are now becoming more sophisticated in bypassing the Geo-location controls by using proxies (Anonymous IPs) to spoof their IP address, it has become very much necessary to come up with a means …
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 …
VIRUS CREATION »
How to Test the Working of your Antivirus – EICAR Test
Have you ever wondered how to test your Antivirus software to ensure it’s proper working? Well here is a quick and easy way to test your antivirus. The process is called EICAR test which will …
Categories
Blogroll
Recent Comments
Most Commented
Most Popular
Log In | Entries (RSS) | Comments (RSS) | Sitemap