Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Print Triangle in C#
WhatsApp
Sonu Chaudhary
May 25
2016
1.4
k
0
0
Prymaid1.rar
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
prymid
{
class
Program
{
static
void
Main(
string
[] args)
{
int
i, j, r;
int
v = 1;
Console.WriteLine(
"Enter no of Rows"
);
r = Int16.Parse(Console.ReadLine());
Console.WriteLine(r);
for
(i = 1; i <= r; i++)
{
for
(j = r; j >= i - 1; j--)
{
Console.Write(
" "
);
}
for
(
int
k = 1; k <= i; k++)
{
Console.Write(
" "
+ v);
v++;
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
Triangle
C#
Up Next
Print Triangle in C#