using System; public class Test { public static void Main() { var number = Console.ReadLine(); int n = Convert.ToInt32(number); PrintPattern print = new PrintPattern(); print.Printpyramid(n); } } public class PrintPattern { public void Printpyramid(int n) { int dummy=1; for(int i=0;i<n;i++) { for(int j=n;j>i;j--) { if(i==0||j==n||j==dummy) { Console.Write("* "); } else { Console.Write(" "); } } dummy++; Console.WriteLine(); } } }OUTPUT* * * * * * * * * * * * * * *
LATEST using System ; using System . Linq ; public class Test { public static void Main () { int arrayLength ; int T = Convert . ToInt32 ( Console . ReadLine ()); for ( int i = 0 ; i < T ; i ++) { arrayLength = Convert . ToInt32 ( Console . ReadLine ()); string Line = Console . ReadLine (); GetMinimumDistanceBetweenStrings ( arrayLength , Line ); } } public static void GetMinimumDistanceBetweenStrings ( int length , string Line ) { int min = - 1 ; int initial = 0 ; string [] stringArray = Line . Split ( " " ); for ( int start = 0 ; start < length - 1 ; start ++) { for ( int a = start + 1 ; a <= length - 1 ; a ++) { if ( stringArray [ start ]== stringArray [ a ]) { if ( initial == 0 ) ...
Comments
Post a Comment