为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

c#实现3和4的公倍数

2017-10-12 5页 doc 17KB 25阅读

用户头像

is_594905

暂无简介

举报
c#实现3和4的公倍数c#实现3和4的公倍数 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test1 { class Program { static void Main(string[] args) { int n; string s; Console.WriteLine("请输入一个数:"); s=Console.ReadLine(); n = int.Parse(s);...
c#实现3和4的公倍数
c#实现3和4的公倍数 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test1 { class Program { static void Main(string[] args) { int n; string s; Console.WriteLine("请输入一个数:"); s=Console.ReadLine(); n = int.Parse(s); if (n % 4 == 0 && n % 3 == 0) Console.WriteLine("该函数能同时被3和4整除"); else Console.WriteLine("该函数不能同时被3和4整除"); } } } 题目二: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { string s; int a, b, c, d; Console.WriteLine("请输入一个三位正整数"); s = Console.ReadLine(); a = int.Parse(s); b = a/100; c = (a - b * 100) / 10; d = (a - b * 100 - 10 * c); Console.WriteLine("{0}{1}{2}",d ,c,b); } } } 2 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication7 { class Program { static void Main(string[] args) { string s; int a; s=Console.ReadLine(); a = int.Parse(s); if (a % 3 == 0 && a % 4 == 0) Console.Write("能被整除"); else Console.WriteLine("不能被整除"); } } } 2、编程将用户输入的一个三位正整数逆序输出。 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication9 { class Program { static void Main(string[] args) { string s; int a, b, c, d; Console.WriteLine("请输入一个三位数"); s = Console.ReadLine(); a = int.Parse(s); b = a % 10; c = ((a - b) % 100) / 10; d = (a - b - (a - b) % 100) / 100; Console.WriteLine("{0}{1}{2}", b, c, d); } } } 3 2、编程将用户输入的一个三位正整数逆序输出。 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ex4 { class Program { static void Main(string[] args) { string s; uint a, b, c, t, h; Console.WriteLine("请输入一个三位正整数:"); s = Console.ReadLine(); t = uint.Parse(s); a = t % 10; c = t / 100; b = (t - c * 100) / 10; h = a * 100 + b * 10 + c; if (a != 0) Console.WriteLine("逆序后的数为:{0}", h); else Console.WriteLine("逆序后的数为:0{0}", h); } } }
/
本文档为【c#实现3和4的公倍数】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
热门搜索

历史搜索

    清空历史搜索