Want more features on Pastebin? Sign Up, it's FREE!
Guest

minnumber

By: a guest on Mar 24th, 2014  |  syntax: None  |  size: 1.29 KB  |  views: 97  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // ConsoleApplication1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "stdlib.h"
  6. #include "stdio.h"
  7.  
  8. int getmin (int val1, int val2, int val3, int val4, int val5);
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12.         int score1, score2, score3, score4, score5;
  13.  
  14.         printf("Please enter Score 1: ");
  15.         scanf_s("%d", &score1);
  16.         printf("Please enter Score 2: ");
  17.         scanf_s("%d", &score2);
  18.         printf("Please enter Score 3: ");
  19.         scanf_s("%d", &score3);
  20.         printf("Please enter Score 4: ");
  21.         scanf_s("%d", &score4);
  22.         printf("Please enter Score 5: ");
  23.         scanf_s("%d", &score5);
  24.  
  25.         printf("Lowest score: %d", getmin(score1, score2, score3, score4, score5));
  26.  
  27.         system("pause");
  28.         return 0;
  29. }
  30.  
  31. int getmin (int val1, int val2, int val3, int val4, int val5){
  32.         int min;
  33.  
  34.         if(val1 < val2 && val1 < val3 && val1 < val4 && val1 < val5){
  35.                 min = val1;
  36.                 return min;
  37.         }else if (val2 < val1 && val2 < val3 && val2 < val4 && val2 < val5){
  38.                 min = val2;
  39.                 return min;
  40.         }else if (val3 < val1 && val3 < val2 && val3 < val4 && val2 < val5){
  41.                 min = val3;
  42.                 return min;
  43.         }else if (val4 < val1 && val4 < val2 && val4 < val3 && val4 < val5){
  44.                 min = val4;
  45.                 return min;
  46.         }else if (val5 < val1 && val5 < val2 && val5 < val3 && val5 < val4){
  47.                 min = val5;
  48.                 return min;
  49.         }
  50.  
  51. }
clone this paste RAW Paste Data