Write a program in C# Sharp to display the pattern like right angle triangle using an asterisk

  • برمجة سي شارب
  • برمجة

Write a program in C# Sharp to display the pattern like right angle triangle using an asterisk

Sample Output:

*
**
***
****

Sample Output:

Display the pattern like right angle using asterisk:                                                          
------------------------------------------------------                                                        
                                                                                                              
Input number of rows : 10                                                                                     
*                                                                                                             
**                                                                                                            
***                                                                                                           
****                                                                                                          
*****                                                                                                         
******                                                                                                        
*******                                                                                                       
********                                                                                                      
*********                                                                                                     
**********
 

الأجوبة

using System;  
public class Exercise9  
{  
    public static void Main() 
{
    int i,j,rows;
	Console.Write("\n\n");
    Console.Write("Display the pattern like right angle using asterisk:\n");
    Console.Write("------------------------------------------------------");
    Console.Write("\n\n");   
   
   Console.Write("Input number of rows : ");
   rows= Convert.ToInt32(Console.ReadLine());   
   for(i=1;i<=rows;i++)
   {
	for(j=1;j<=i;j++)
	   Console.Write("*");
	Console.Write("\n");
   }
  }   
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...