5 5 5 5 5 5 5 5 5
5 4 4 4 4 4 4 4 5
5 4 3 3 3 3 3 4 5
5 4 3 2 2 2 3 4 5
5 4 3 2 1 2 3 4 5
5 4 3 2 2 2 3 4 5
5 4 3 3 3 3 3 4 5
5 4 4 4 4 4 4 4 5
5 5 5 5 5 5 5 5 5
int main()
{
int i, j, n=5;
for(i=n; i>1; i--)
{
for(j=n;j>=1;j--)
{
if(j>i) printf("%d ", j);
else printf("%d ", i);
}
for(j=2;j<=n;j++)
{
if(j>i) printf("%d ", j);
else printf("%d ", i);
}
printf("\n");
}
for(i=1; i<=n; i++)
{
for(j=n;j>=1;j--)
{
if(j>i) printf("%d ", j);
else printf("%d ", i);
}
for(j=2;j<=n;j++)
{
if(j>i) printf("%d ", j);
else printf("%d ", i);
}
printf("\n");
}
return 0;
}
A Tech publication for all. Get Knowledge about Web Development, Programming, and trending news, tutorials, and tools for beginners to experts.
Sunday, September 18, 2016
Pyramid top view using 1 to 5
Subscribe to:
Post Comments (Atom)
B
BEING CODERS
Take Your Coding Journey Further!
Find more coding tutorials, technology insights, programming guides, and practical knowledge. Choose your reading experience below!
✦ Keep Learning. Keep Building. Keep Coding. ✦
-
1 23 456 78910 #include<stdio.h> int main() { int i,j,k; k=1; for(i=1;i<5;i++) { for(j=1;j<=i;j++) { printf("%d",k++);...
-
Learn how to configure Let’s Encrypt SSL on Windows 11 using Win-ACME and IIS. Securing your website with HTTPS is no longer optional—it’s a...
-
A fresh year brings fresh possibilities. ✨ New goals to work toward. New memories to make. New ideas waiting to take shape. But with so m...
-
Complete beginner-friendly guide to generate and install a free SSL certificate on Windows server If you’re running a website on Windows Se...
-
World Country, State and City Database in SQL and JSON Format (Step-by-Step Guide) If you want to add all countries, states/provinces, and ...
-
1 10 101 1010 10101 #include<stdio.h> int main() { int i,j,k; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("%d",j%2)...
-
ABCDE BCDE CDE DE E #include <stdio.h> int main() { int i, j; for(i=1;i<=5;i++) { for(j=i;j<=5;j++) ...
-
How do you make a mark with a new company in a competitive market? How did Facebook reach its first $100 million mark in revenue? The answer...
-
13579 3579 579 79 9 #include <stdio.h> int main() { int i,j; for(i=1;i<=9;i+=2) { for(j=i;j<=9;j+=2) { print...
-
1 21 321 4321 54321 CODE: #include <stdio.h> int main() { int i, j; for(i=1;i<=5;i++) { for(j=i;j>=1;j--) { printf("%d...
No comments:
Post a Comment