42,889 views
4 votes
4 votes
Write a program that allows the user to continuously input the value n until a negative number is entered

User Eddywashere
by
2.4k points

1 Answer

13 votes
13 votes

Answer:

Written in C++

Step-by-step explanation:

#include <iostream>

using namespace std;

int main()

{

int n;

while(true)

{

cin>>n;

if(n>=0)

continue;

break;

}

return 0;

}

User Jethro Hazelhurst
by
2.9k points