Based on Control Structure Selection and Control Structure Looping, answer the following questions:
Write a program that will ask the user to input n positive numbers. The program will terminate if one of those numbers is not positive. Output :
https://cdn.discordapp.com/attachments/711213157854609461/839150310864846934/unknown.png
#include <iostream>
using namespace std;
int main(){
int n;
do{
cout<<"Enter a number: ";
cin>>n;
}while(n >= 0);
return 0;
}
Comments
Leave a comment