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(); } } }
-----------------------------------------------
-----------------------------------------------
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(); } //-------------输出乘法口诀:------------------- } } }
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(); } } }
-----------------------------------------------
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(); } } }
-----------------------------------------------
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(); } } }
-----------------------------------------------
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(); } } }
-----------------------------------------------
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(); } } }
-----------------------------------------------
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(); } } } }
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------------------------
C#打印九九乘法表的更多相关文章
- scala打印九九乘法表的5种实现
使用scala打印九九乘法表,可以有多种实现方法,实现的过程充分的体现的scala语言的优势和巨大的简洁性和高效性, 下面我用了5种方法实现九九乘法表. 使用类似于java,c++等指令风格的的编程实 ...
- 利用Python循环(包括while&for)各种打印九九乘法表
一.for循环打印九九乘法表 #注意:由于缩进在浏览器不好控制,请大家见谅,后续会有图片传入. 1.1 左下角 for i in range(1,10): for j in range(1,i+1): ...
- 写一个方法,用一个for循环打印九九乘法表
public class MultiplicationTable { /** * @description 写一个方法,用一个for循环打印九九乘法表 * @author wangkun * ...
- python脚本7_打印九九乘法表
#打印九九乘法表 for i in range(1,10): s = "" for j in range(1,i+1): s += str(j) + '*' + str(i) + ...
- python—用for循环、while循环和一句话打印九九乘法表
用for循环打印九九乘法表: for i in range (1,10): for j in range(1,10): print(j,"x",i,"=",i* ...
- 【Java】Java_15 打印九九乘法表
使用For循环嵌套即可打印九九乘法表 以下是具体代码: /** * 打印九九乘法表 */ package com.oliver.test; public class TestMultiplicatio ...
- 使用whIle循环语句和变量打印九九乘法表
-设置i变量declare @i int --设置j变量declare @j int --设置乘法表变量declare @chengfabiao varchar(1000)--给i,j,@chengf ...
- python3 打印九九乘法表
打印九九乘法表 # !/usr/bin/env python # -*- coding:utf-8 -*- # Author:Hiuhung Wan for i in range(1, 10): fo ...
- 【shell脚本】打印九九乘法表
打印九九乘法表 一.seq介绍 seq命令用于以指定增量从首数开始打印数字到尾数,即产生从某个数到另外一个数之间的所有整数,并且可以对整数的格式.宽度.分割符号进行控制 语法: [1] seq [选项 ...
随机推荐
- epii.js简约而不简单的JS模板引擎
epii.js是什么 epii.js是一个 模板引擎,可快速实现数据与ui绑定,快速实现事件绑定,与处理,不依赖任何第三方库,仅仅8k,在native+webapp开发 和 web开发,h5微网页上均 ...
- vue+webpack项目实际工作中需要生成一个配置文件供生产环境使用
大家都知道webpack打包十分方便,但是在工作中,前端写好的项目需要后端进行部署,就需要有一个配置文件. 使用插件 : GenerateAssetPlugin , 使用方法 : 1 在项目中安装 ...
- Eclipse安装反编译工具JadClipse for Eclipse手把手教程
今天闲来无事准备弄弄eclipse的反编译工具JadClipse for Eclipse,百度经验里也说的比较清楚只是两个文件下载地址没有明确 net.sf.jadclipse_3.3.0.jar ...
- Linux下protobuf的编译与安装【各种奇葩问题】
1.下载源码 首先,从github上下载protobuf的源码,地址:https://github.com/google/protobuf,我选择下载2.5.0版本. 2.编译protobuf 2.1 ...
- Mybatis JPA 代码构建
前段时间了解到Spring JPA,感觉挺好用,但其依赖于Hibernate,本人看到Hibernate就头大(不是说Hibernate不好哈,而是进阶太难),于是做了一个迷你版的Mybatis JP ...
- EasyUI combobox 中文无法检索最终解决方案!
写在前面: 因为之前一直用EasyUI的combobox控件,但是苦于在火狐浏览器下输入中文无法直接检索必须在输入完成后再敲击一下键盘才可以(按一下shift或空格),原因是中文输入法屏蔽了EasyU ...
- http post,get,put,delete区别(收集整理)
摘要: 这篇文章想从restful角度来分析下http的方法get,post,put,delete的区别.先暂时收集下资料~~~ 一 Http 规范中的get与post 根据 HTTP 规范,GET ...
- JAVA学习路线图(一文详解)
此乃是java攻城狮的学习路线图,由简到繁,由易到难,一步步的学习,最后成为JAVA攻城狮. 阶段1 1:学习HTML 2:学习CSS 3:JavaScript 4:jQuery 5:xml解析 6: ...
- Android保存图片到本地相册
好久没有写东西了.备份下知识吧.免得忘记了 . 首先贴一段代码 -- 这个是先生成一个本地的路径,将图片保存到这个文件中,然后扫描下sd卡.让系统相册重新加载下 .缺点就是只能保存到DCIM的文 件 ...
- vue-cli的webpack模板项目配置文件分析
由于最近在vue-cli生成的webpack模板项目的基础上写一个小东西,开发过程中需要改动到build和config里面一些相关的配置,所以刚好趁此机会将所有配置文件看一遍,理一理思路,也便于以后修 ...