首页 > 学院 > 开发设计 > 正文

[华为闯关篇]001数字颠倒

2019-11-08 02:36:13
字体:
来源:转载
供稿:网友

题目描述:输入一个整数,将其倒序输出为一个字符串。例如输入整数9635,则输出字符串为5369

输入描述:输入一个整数

输出描述:输出其倒序的字符串

输入样例:12345

输出样例:54321

算法实现:

#include<iostream>using namespace std;//************************************************  // * Author: 赵志乾  // * Date: 2017-2-18   // * Declaration: All Rigths Reserved !!!  //***********************************************/int main(){	int indata;	cin>>indata;	while(indata!=0)	{		cout<<indata%10;		indata/=10;	}	cout<<endl;	return 0;}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表