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微网页上均 ...
- Entity Framework Core 生成跟踪列
本文翻译自<Entity Framework Core: Generate tracking columns>,由于水平有限,故无法保证翻译完全正确,欢迎指出错误.谢谢! 注意:我使用的是 ...
- vim的tab键设定
多在windows上编程的童鞋可能习惯于感受tab键为4个空格的长度,不过在linux系统中一般默认设定tab键为8个空格长度来显示.事实上tab也确实是8个空格的长度.不过由于习惯问题,某些童鞋还是 ...
- Mybatis Mapper.java和Mapper.xml能否分离问题
Mybatis Mapper.java和Mapper.xml是能分离的. 从图上不难看出,不管是/java还是/resources,他们最终编译后的存放路径均是/target/classes 因此将x ...
- TypeScript02 方法特性【参数种类、参数个数】、generate方法、析构表达式、箭头表达式、循环
1 方法的参数 1.1 必选参数 调用方法时实参的个数必须和定义方法时形参在数量和类型上匹配 /** * Created by Administrator on 2017/8/2 0002. */ f ...
- OpenCV1.0在VC ++6.0下的配置
1.本人使用win7操作系统,首先要预装VC++6.0,安装方法不再赘述. 2.在OpenCV官方网站下载OpenCV的安装文件"OpenCV_1.0.EXE"(参考链接:http ...
- img标签在div中水平垂直居中--两种实现方式
第一种方式: text-align:center; vertical-align:middle; div{ text-align: center; vertical-align:middle;widt ...
- 谈一谈EasyUI的TreeGrid的过滤功能
写在最前面 这个星期一直在纠结easyui的treegrid的过滤功能,原因呢,自然是项目中一个莫名奇妙的需求. easyui虽说是后端程序员的前端框架,但是说句实话,除去api,让我直接写里面的节点 ...
- zabbix_server---微信报警
(1) 企业应用-创建应用 1.除了对个人添加微信报警之外,还可以添加不同管理组,接受同一个应用推送的消息, 成员账号,组织部门ID,应用Agent ID,CorpID和Secret, ...
- java 将一个ip地址分割成一个数组
这个问题以前真还没注意,好像记得分割过规律的字符串,但是不是像IP这样是以"."为分割规律字符,而是的. 今天用到又用到个,代码写好了也没测试,直接上传服务器,但是就是会报错,之后 ...