C#打印九九乘法表

时间:2023-11-24 12:22:38

C#打印九九乘法表、、、

----------------------------------

C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace demo {
   public class Test {
                   public static void Main(String [] args) {
						 for (int i = 1; i < 10; i++) {
						   for (int s = 1; s <= i; s++) {
							 Console.Write(s + "*" + i + "=" + i * s + " ");
							 if (i == s) {
							   Console.Write("\n");
							 }						   }
						 }
					     Console.Write("请按任意键急促...........");
					Console.ReadKey();  }
   }
}

-----------------------------------------------

C#打印九九乘法表

-----------------------------------------------

using System;
using System.Collections.Generic;
namespace demo
{
   public class Test
   {
                   public static void Main(String [] args)
                   {
					   Console.WriteLine("C#C#C#C#C#C#C#C#C#C#C#C#");
                            Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
						Console.WriteLine("C#C#C#C#C#C#C#C#C#C#C#C#");
			//-------------输出乘法口诀:-------------------
			Console.WriteLine("九九乘法表——按回车键继续");//打印表头
            int i;//定义变量i
            int j;//定义变量j
            for (i = 1; i < 10; i++)
            {
                for (j = 1; j <= i; j++)
                {
                    //输入计算公式
                    Console.Write("{0}×{1}={2}\t", j, i, j * i);
                }
                Console.WriteLine();
                Console.ReadLine();
            }
			//-------------输出乘法口诀:-------------------
	   Console.WriteLine("C#C#C#C#C#C#C#C#C#C#C#C#");
                            Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
							Console.WriteLine("Hello World !");
						Console.WriteLine("C#C#C#C#C#C#C#C#C#C#C#C#");
//-------------输出乘法口诀:-------------------
			Console.WriteLine("九九乘法表——按回车键继续");//打印表头
            int x;//定义变量i
            int y;//定义变量j
            for (x = 1; x < 10; x++)
            {
                for (y = 1; y <= x; y++)
                {
                    //输入计算公式
                    Console.Write("{0}×{1}={2}\t", y, x, y * x);
                }
                Console.WriteLine();
                Console.ReadLine();
            }
			//-------------输出乘法口诀:-------------------
                   }
   }
}

 C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;  

namespace demo
{
   public class Test1
   {
                   public static void Main(String [] args)
                   {
                            for (int i = 1; i < 10; i++)
            {
                for (int j = 1; j <= i; j++)
                {
                    Console.Write(string.Format("{0}*{1}={2} ", j, i, i * j));
                }
                Console.WriteLine();
            }
            Console.Read();
         }
   }
}

 

-----------------------------------------------

C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;  

namespace demo
{
   public class Test2
   {
                   public static void Main(String [] args)
                   {  

						 for (int i = 1; i < 10; i++) {
						   for (int s = 1; s <= i; s++) {
							 Console.Write(s + "*" + i + "=" + i * s + " ");
							 if (i == s) {
							   Console.Write("\n");
							 }
						   }
						 }
					     Console.Write("请按任意键继续...........");
						 Console.ReadKey();

                   }
   }
}

  

-----------------------------------------------

C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;  

namespace demo
{
   public class Test3
   {
                   public static void Main(String [] args)
                   {
                            Console.WriteLine("Hello World !");
							 //倒三角
            for (int i = 9; i >= 1; i--)
            {
                for (int j = i; j >= 1; j--)
                {

                    Console.Write("{0}*{1}={2} ", i, j, i * j);  //不换行
                }
                Console.WriteLine(); //换行
            }
            Console.ReadLine();
                   }
   }
}

  

-----------------------------------------------

C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;  

namespace demo
{
   public class Test4
   {
                   public static void Main(String [] args)
                   {
                            Console.WriteLine("Hello World !");
							for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <=i; j++)
                {
                    Console.Write(j+"×"+i+"="+i*j+"\t");
                }
                Console.WriteLine();
            }
Console.Read();
                   }
   }
}

  

-----------------------------------------------

C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;  

namespace demo
{
   public class Test6
   {
                   public static void Main(String [] args)
                   {
                            Console.WriteLine("Hello World !");
							  //one
            Console.WriteLine("        九九乘法表");
            for (int i = 1; i <= 9; i++) {
                for (int j = 1; j <= 9; j++) {
                    Console.Write("{0}*{1}={2,-2} ", i, j, i*j);
                }
                Console.WriteLine();
            }  

            //two
            Console.WriteLine("九九乘法表");
            for (int i = 1; i <= 9; i++) {
                for (int j = 1; j <= i; j++) {
                    Console.Write("{0}*{1}={2,-2} ", i, j, i * j);
                }
                Console.WriteLine();
            }  

            //three
            Console.WriteLine("九九乘法表");
            for (int i = 1; i <=9; i++) {
                    for (int k = 0; k < i - 1; k++) {
                        Console.Write("       ");
                    }
                    for (int j = i; j <= 9; j++)
                    {
                        Console.Write("{0}*{1}={2,-2} ", i, j, i * j);
                    }
                Console.WriteLine();
            }
                Console.ReadLine();
                   }
   }
}

  

-----------------------------------------------

C#打印九九乘法表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;  

namespace demo
{
   public class Test7
   {
                   public static void Main(String [] args)
                   {
                            Console.WriteLine("Hello World !");
							 int sum=0; //乘积
        for(int i=1;i<10;i++) //乘数
        {
            for(int j=1;j<=i;j++) //被乘数
            {
                sum=i*j;
                Console.Write("{1}*{0}={2}\t",i,j,sum);
            }
			   Console.ReadKey();
                   }
				    }
   }
}

  

-----------------------------------------------

-----------------------------------------------

-----------------------------------------------

-----------------------------------------------

-----------------------------------------------

-----------------------------------------------

-----------------------------------------------

-----------------------------------------------------------------