write a program in java to input 20 numbers at a row from the user and display the pair of numbers those are consecutive (use only string and not arrays)
eg 22,24 33,34,57,98,99
out put. 33 and 34
98 and 99
Answers
Answered by
1
// C++ program to How will you print
// numbers from 1 to 100 without using loop?
#include <iostream>
using namespace std;
class gfg
{
// Prints numbers from 1 to n
public:
void printNos(unsigned int n)
{
if(n > 0)
{
printNos(n - 1);
cout << n << " ";
}
return;
}
};
// Driver code
int main()
{
gfg g;
g.printNos(100);
return 0;
}
// This code is contributed by SoM15242
Similar questions