用c++设计一个程序,输入一个整数,输出组成该整数的各位数字,并求出它们的和

日期:2018-04-18 09:48:14 人气:1

用c++设计一个程序,输入一个整数,输出组成该整数的各位数字,并求出它们的和

#include using namespace std ; int main() { int n; int unit,tens,hund; cin >> n ; unit = n%10 ; tens= n/10%10; hund=n/100; if ( hund < tens ) { int temp=hund;hund=tens;tens=temp; } if ( hund < unit ) { int temp=hund;hund=unit;u...
    A+
热门评论