For loopPCPisi Can11yAsked Nov 13, 2015, 2:35 AM ESTSolvedShareLinkedInXCopy linkSave How can print the following output on console using for loop? 1121 12321 1234321 123454321
For loopPCPisi Can11yAsked Nov 13, 2015, 2:35 AM ESTSolvedShareLinkedInXCopy linkSave How can print the following output on console using for loop? 1121 12321 1234321 123454321
Banketeshvar NarayanRank #235 · 10.5K reputation11y agoPosted Nov 13, 2015, 5:23 AM EST✓ Accepted answer+1Hi, use the below code it will give the exact result you need.using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace ConsoleApplication59{ class Program { static void Main(string[] args) { int numberoflayer = 6, Space, Number; Console.WriteLine("Print paramid"); for (int i = 1; i <= numberoflayer; i++) // Total number of layer for pramid { for (Space = 1; Space <= (numberoflayer - i); Space++) // Loop For Space Console.Write(" "); for (Number = 1; Number <= i; Number++) //increase the value Console.Write(Number); for (Number = (i - 1); Number >= 1; Number--) //decrease the value Console.Write(Number); Console.WriteLine(); } } }}Please accept as answer if it helps you!!+1Banketeshvar NarayanRank #235 · 10.5K reputation11y agoPosted Nov 13, 2015, 4:27 AM EST0Hi,this link may help youhttp://stackoverflow.com/questions/5037012/making-pyramid-using-c-sharp0PCPisi Can21 reputation11y agoPosted Nov 13, 2015, 5:30 AM EST0Thank you.0Banketeshvar NarayanRank #235 · 10.5K reputation11y agoPosted Nov 13, 2015, 5:34 AM EST0Welcome Tayfun Baltaci.0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Banketeshvar NarayanRank #235 · 10.5K reputation11y agoPosted Nov 13, 2015, 4:27 AM EST0Hi,this link may help youhttp://stackoverflow.com/questions/5037012/making-pyramid-using-c-sharp0
Banketeshvar NarayanRank #235 · 10.5K reputation11y agoPosted Nov 13, 2015, 5:34 AM EST0Welcome Tayfun Baltaci.0
Banketeshvar NarayanRank #235 · 10.5K reputationPosted Nov 13, 2015, 5:23 AM EST
use the below code it will give the exact result you need.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication59
{
class Program
{
static void Main(string[] args)
{
int numberoflayer = 6, Space, Number;
Console.WriteLine("Print paramid");
for (int i = 1; i <= numberoflayer; i++) // Total number of layer for pramid
{
for (Space = 1; Space <= (numberoflayer - i); Space++) // Loop For Space
Console.Write(" ");
for (Number = 1; Number <= i; Number++) //increase the value
Console.Write(Number);
for (Number = (i - 1); Number >= 1; Number--) //decrease the value
Console.Write(Number);
Console.WriteLine();
}
}
}
Please accept as answer if it helps you!!
Banketeshvar NarayanRank #235 · 10.5K reputationPosted Nov 13, 2015, 4:27 AM EST
this link may help you
http://stackoverflow.com/questions/5037012/making-pyramid-using-c-sharp
Pisi Can21 reputationPosted Nov 13, 2015, 5:30 AM EST
Banketeshvar NarayanRank #235 · 10.5K reputationPosted Nov 13, 2015, 5:34 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts