Skip to content

Commit

Permalink
Ch.05 Exercise 11
Browse files Browse the repository at this point in the history
  • Loading branch information
PureJoyMind committed Aug 31, 2021
1 parent 8842b45 commit de0c015
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ch.05/smallestValue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Deitel ch.05 exercise 5.11
// Finding the smallest of several integers
#include <iostream>

using namespace std;

int main(){
int num{0}; // the number of integers entered
int numInput; // input integer for each iteration
int smallest{numInput}; // the smallest number

cout << "enter the number of integers: \n";
cin >> num;

for(int i{1}; i <= num; i++){
cout << "Enter integer: "<< endl;
cin >> numInput;

if(numInput < smallest){
smallest = numInput;
}
}
cout << "the smallest number is "<< smallest << endl;
}

0 comments on commit de0c015

Please sign in to comment.