Write a program that takes integers from the user one at a time. Assume the input is some number of positive integers. The user will type in 0 to end the input and the 0 should not be counted as input. Your program should find the smallest value input and then print it to the screen. If the input is 6 9 3 5 0, the output is 3. You can assume at least one positive integer is input. c++ g

Respuesta :

Answer:

#include <iostream>

using namespace std;  

int main()

{

  cout<<"Enter numbers (0 to end) "<<endl;

  int num;

   cin>>num;  

  int minimum = num;

  while(num>0)

  {

  cin>>num;

 

  if(num < minimum && num!=0)

  {

  minimum = num;

  }

  }

 

  cout<<"The minimum number is: "<<minimum;

  return 0;

}