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 [选项 ...
随机推荐
- CJOJ 2485 UVa 11991 生日礼物 / UVa 11991 Easy Problem from Rujia Liu?
CJOJ 2485 UVa 11991 生日礼物 / UVa 11991 Easy Problem from Rujia Liu? Description (原题来自刘汝佳<训练指南>Pa ...
- Mongoose基础入门
前面的话 Mongoose是在node.js异步环境下对mongodb进行便捷操作的对象模型工具.本文将详细介绍如何使用Mongoose来操作MongoDB NodeJS驱动 在介绍Mongoose之 ...
- Spring NamedParameterJdbcTemplate命名参数查询条件封装, NamedParameterJdbcTemplate查询封装
Spring NamedParameterJdbcTemplate命名参数查询条件封装, NamedParameterJdbcTemplate查询封装 >>>>>> ...
- servlet前台中文参数处理
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletExcep ...
- Windows7 下安装 tersorflow
最近看起深度学习的一些知识,想要学习一个框架.在网上看了别人对这些框架的评比后,决定学习 tersorflow.之前一直以为 tersorflow 只可以在 Linux 下安装,出乎意料的是,Wind ...
- Jmeter实现MD5加密
Jmeter3.0以后的版本不再内置MD5加密函数,只能自己写了. 1.编码 package com.liuke.test; import java.security.MessageDigest; i ...
- Multimodal —— 看图说话(Image Caption)任务的论文笔记(二)引入attention机制
在上一篇博客中介绍的论文"Show and tell"所提出的NIC模型采用的是最"简单"的encoder-decoder框架,模型上没有什么新花样,使用CNN ...
- 关于html转换为pdf案例的一些测试与思考
由于工作所需,最近花时间研究了html转换为pdf的功能.html转换为pdf的关键技术是如何处理网页中复杂的css样式,通过在网上收集资料,发现目前html 转换为pdf的解决方案主要分为三类: 客 ...
- [BZOJ 4325][NOIP 2015] 斗地主
一道防AK好题 4325: NOIP2015 斗地主 Time Limit: 30 Sec Memory Limit: 1024 MBSubmit: 820 Solved: 560[Submit] ...
- MySQL优化 - 所需了解的基础知识
时隔一年半,期间一直想写但却觉得没有实质性的内容可记录,本文为 [高性能MySQL] 的学习日志整理分享(感兴趣建议读原书). 优化应贯穿整个产品开发周期中,开发过程中考虑一些性能问题与影响,总比出问 ...