9月24日作业

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{	
	int n;
	cin>>n;
	int cnt = 0;
	int i =1;
	while(i<=n)
	{
		int tmp = i;
		while(tmp!=0)
		{
			if(tmp%10 == 0)
			{
				cout<<tmp<<endl;
				cnt++;
				break;
			}
			tmp = tmp/10;
		}
		i++;
	}
	cout<<cnt;
	return 0;
}



#include<iostream>
#include<iomanip>
using namespace std;
int main()
{	
	int n;
	cin>>n;
	int cnt = 0;
	int tmp = n;
	while(tmp!=0)
	{
		tmp = tmp/10;
		cnt++;
	}
	cout<<cnt;
	tmp = n;
	int sum =0;
	while(tmp!=0)
	{
		sum = sum*10 + tmp%10;
		tmp = tmp/10;
	}
	int a = sum;
	while(sum!=0)
	{
		cout<<sum%10<<"";
		sum = sum/10;
	}
	cout<<endl<<a;
	return 0;
}



#include<iostream>
#include<iomanip>
using namespace std;
int main()
{	
	int n;
	cin>>n;
	int cnt = 0;
	int i = 1;
	while(i!=n)
	{
		int tmp = i;int sum = 0;
		while(tmp!=0)
		{
			sum = sum+tmp%10;
			tmp = tmp/10;
		}
		if(sum == 13)
		{
			cout<<i<<" ";
			cnt++;
		}
		i++;
	}
	cout<<endl<<cnt;
	return 0;
}



#include<iostream>
#include<iomanip>
using namespace std;
int main()
{	
	int n;
	cin>>n;
	int i =1;
	int cnt =0;
	while(i<=n)
	{
		int t = i;
		int sum =0;
		while(t!=0)
		{
			sum = sum*10+t%10;
			t = t/10;
		}
		if(i == sum)
		{
			cout<<i<<" ";
			cnt++;
		}
		
		i++;
	}
	cout<<endl<<cnt;
	return 0;
}












评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值