0

For loop in C#, C sharp

HOW TO DRAW THIS PATTERN WITH WRITE(“*”), WRITE(“-“), AND WRITELINE ****** ****- ***— **—- *—— ——- SO I HAVE THIS CODE static void DrawStarAndMinus(int n) { for (int i=1; i<=n; i++) { for (int j=i; j<=n; j++) { Console.Write("*"); Console.Write("-“) Console.WriteLine(); } } } static———{ DrawStarAndMinus(5) } OUT PUT *****- ****- ***- **- *-

28th Jan 2020, 8:02 PM
Microne mafika
Microne mafika - avatar
2 Antworten
+ 8
Microne mafika Please, If you need help, you can post the code you're struggling with!  ‱ https://www.sololearn.com/post/75089/?ref=app
28th Jan 2020, 9:29 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 1
Code about that how much you know, show your try and for the rest ask here for community help.. It's only you know use of if condition, use else part also.. There You can see solution... Edit: Microne mafika Replace this in function for (int i=n; i>=1; i--) { for (int j=1; j<=n; j++) { if(i>=j) Console.Write("*"); else Console.Write("-"); } Console.WriteLine(); } Note: after updating, to know others give a reply or tag someone name to know them..
28th Jan 2020, 8:11 PM
Jayakrishna 🇼🇳