#include <iostream>
using namespace std;
int main()
{
cout << "Enter a number: ";
int target;
cin >> target;
int num = 0;
int sum;
while ((sum != target) && (num <= target))
{
num++;
sum = (num + (num + 1));
if (num == target)
{
cout << "No consecutive sums found.";
return 0;
}
}
cout << "The two consecutive numbers adding up to " << target << " are: \n" << num << "\n" << (num + 1);
return 0;
}
----------------------------
Use this c++ code.
P.S. that's impossible because the sum of two consecutive integers (which means an odd and an even) has to be odd.
Chat with our AI personalities
There are no two consecutive whole numbers that sum to 142.With two consecutive whole numbers, one is even and the other odd, and their sum will be odd, but 142 is even.Two consecutive even numbers that sum to 142 are 70 and 72.
No, the sum of two consecutive numbers is always an odd number, and is not divisible by two.
There are two consecutive even numbers. The numbers are 62 and 64.
If you mean two consecutive odd numbers then they are 117 and 119
There are no four consecutive whole numbers that add up to 35. The sum of two consecutive [whole] numbers is an even number plus an odd number which is an odd number. The sum of two consecutive numbers and the two next consecutive numbers is the sum of two odd numbers which is even, but 35 is odd, so no four consecutive whole numbers cannot add up to 35.