使用C++编写一个找到数字的程序,其数字的各位数之和为偶数的程序

使用C++编写一个找到数字的程序,其数字的各位数之和为偶数的程序

能被2整除的整数是偶数。因此在本文中,我们给定了一个数n,我们需要找到第n个数字,其数字之和为偶数。前五个数字的数字之和为偶数的数分别是2、4、6、8和11。例如 −

Input : n = 5 Output : 11 Explanation : First 5 numbers with even sum of digits are 2, 4, 6, 8, 11 i.e 5th number is 11. Input : 12 Output : 24登录后复制