Created
May 8, 2015 13:56
-
-
Save krysseltillada/b2a73cbc265aa841374f to your computer and use it in GitHub Desktop.
tracking a smallest number in a loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() | |
{ | |
int curr_num = 0; | |
for(int n = 50; n <= 100; n++) { | |
if(curr_num == 0) { | |
curr_num = n; | |
} | |
else{ | |
if(n > curr_num){ | |
std::cout << curr_num << " is smaller than " << n << std::endl; | |
curr_num = n; | |
} | |
else { | |
curr_num = curr_num; | |
} | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment