C# number pattern logical programBMBrahmaji M10yAsked May 16, 2016, 6:24 PM EDT4 answersShareLinkedInXCopy linkSavehi friends i want some number patterns programs solutions please help me. 1 31353135
C# number pattern logical programBMBrahmaji M10yAsked May 16, 2016, 6:24 PM EDT4 answersShareLinkedInXCopy linkSavehi friends i want some number patterns programs solutions please help me. 1 31353135
Bhuvanesh MohankumarRank #310 · 8.1K reputation10y agoPosted May 17, 2016, 1:17 AM EDT0You can have a for loop to send numbers to the method and check the reverse of number is equal to the number send, use the below logic in method.publicstaticboolgetStatus(stringmyString){returnmyString.SequenceEqual(myString.Reverse());}Mark as answer, if helpful.0
Bhuvanesh MohankumarRank #310 · 8.1K reputation10y agoPosted May 17, 2016, 1:17 AM EDT0You can also use the normal array logic code for same operation.publicstaticboolgetStatus(stringmyString){stringfirst=myString.Substring(0,myString.Length/2);char[]arr=myString.ToCharArray();Array.Reverse(arr);stringtemp=newstring(arr);stringsecond=temp.Substring(0,temp.Length/2);returnfirst.Equals(second);}Mark as answer, if helpful.0
BMBrahmaji M3 reputation10y agoPosted May 17, 2016, 6:35 PM EDT0yes correct, but i want using for loops sir please help me...0
Pankaj Kumar ChoudharyRank #80 · 24.4K reputation10y agoPosted May 17, 2016, 11:00 PM EDT0Try This:static void Main(string[] args) { int num ,col=1; char[] charar; WriteLine("Enter Value of num"); num= int.Parse( ReadLine().ToString()); string patn = string.Empty; string pat2 = string.Empty; for(int i = 1; i <= num; i++) { ; for(int j = 0; j < i - 1; j++) { col += 2; pat2+= col.ToString(); } charar = pat2.ToCharArray(); patn= "1" +new string( charar) ; Array.Reverse(charar); patn = new string(' ', num - i)+new string(charar) + patn ; WriteLine(patn + "\n"); patn = string.Empty; pat2 = string.Empty; col = 1; } ReadLine(); }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
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 17, 2016, 1:17 AM EDT
You can have a for loop to send numbers to the method and check the reverse of number is equal to the number send, use the below logic in method.
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 17, 2016, 1:17 AM EDT
You can also use the normal array logic code for same operation.
Mark as answer, if helpful.
Brahmaji M3 reputationPosted May 17, 2016, 6:35 PM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted May 17, 2016, 11:00 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts