标题:哥姐们啊!求逆输出
只看楼主
wushaocong
Rank: 1
等 级:新手上路
帖 子:4
专家分:7
注 册:2011-9-21
得分:0 
回复 楼主 woshiliuwei
using System;

class test3{
    static void Main(){
        Console.Write("请输入任意一个三位数:");
        string s=Console.ReadLine();
        int x=Convert.ToInt32(s);
        
        Console.WriteLine("逆序后为:{0}{1}{2}",(x%100)%10,(x-(x/100)*100)/10,x/100);
        Console.ReadKey();
    }
}
2011-09-21 23:07
鱼欲语wsj
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-6-7
得分:0 
Console.WriteLine("请输入:");
            int a;
            string s = Console.ReadLine();
            a = Convert.ToInt32(s);
            int b = 0;
            while (a > 0)
            {
                b = b * 10 + a % 10;
                a = a / 10;
               
            }
            Console.WriteLine("倒序输出后的数:{0}", b);
2011-12-02 22:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-348599-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.172433 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved