### One integer instead of two

How can I change it so that I input only one integer instead of two?
 ``12345678910111213141516171819202122232425262728293031323334353637`` ``````#include using namespace std; int main() { int n; int y; int i; int prime; cout <<"Enter two integers : "; cin >> n >> y; while (y >= n) { prime=0; cout << "\n" << n << ":\t" ; for(i=2;i
` cin >> n; `

I think that's what you mean anyway.
Oh okay thank you i did that but i never deleted the `while (y >= n) ` now it works thank you.
No problem, happy to help!
One more thing I have a code that lists if the number is a prime number or a perfect number i want to incorporate the other one where it lists the divisors how would i do that?
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485`` ``````#include #include using namespace std; int checkprime(int n) { int i; int prime=1; for(i=2;i> b; cout << "*******************************" <> input; } while ((input == "N") || (input == "n")); return 0; }``````
 ``1234567891011121314151617181920212223242526272829303132`` ``````#include #include using namespace std; int main() { int num, countA, countB; cout << "Please enter a positive maxiumum integer value you wish to find divisors: \n"; cin >> num; if (num <= 0) { cout << "The input entered was invalid. Please input a positive whole integer.\n"; } else { for(countA = 1; countA <= num; countA++) { cout << "Divisors of " << countA << ": "; for(countB = 1; countB<= num; countB++) { if(countA % countB == 0) { cout << countB << " " ; } } cout << endl; } } return 0; }``````

This is a short example of how you could do something like that.
How can I make it so that after inputting an integer not within the range, you have the option to quit or to continue? I have it set like that if you do enter an integer within the range but can't figure out how to have it setup the same.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124`` ``````#include #include using namespace std; int checkprime(int n) { int i; int prime=1; for(i=2;i> b; cout << "*******************************" <1000) { cout << "Please enter an integer that is within the range." <> input; } while ((input == "N") || (input == "n")); return 0; } ``````
Topic archived. No new replies allowed.