在本教程中,我们将讨论一个程序,以查找满足给定条件的可能的N位数。
为此,我们将提供一个整数。我们的任务是检查跟随N位数字中的哪一个
数+倒数(数)= 10N -1
#include <bits/stdc++.h>
using namespace std;
//returning the count of numbers
string count_num(int N){
if (N % 2 == 1)
return 0;
string result = "9";
for (int i = 1; i <= N / 2 - 1; i++)
result += "0";
return result;
}
int main(){
int N = 4;
cout << count_num(N);
return 0;
}输出结果
90