Condition : numbers should asked when function is executed:
#include <iostream> using namespace std; int minnummber() { // local variable declaration int result, num1, num2; cout << "Enter first number :: "; cin >> num1; cout << "Enter second number :: "; cin >> num2; if (num1 > num2) result = num2; else result = num1; return result; } int main () { cout << "Min is "<<minnummber(); return 0; }