Skip to content

Instantly share code, notes, and snippets.

@pellaeon
Created September 25, 2012 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pellaeon/3781793 to your computer and use it in GitHub Desktop.
Save pellaeon/3781793 to your computer and use it in GitHub Desktop.
Example 2-23
/*
* =====================================================================================
*
* Filename: kk.c
*
* Description: KK
*
* Version: 1.0
* Created: 2012年09月25日 18時52分43秒
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include <stdlib.h>
#include <limits.h>
/*
* === FUNCTION ======================================================================
* Name: main
* Description:
* =====================================================================================
*/
int
main ( int argc, char *argv[] )
{
int number[5];
int max=INT_MIN, min=INT_MAX;
int i=0;
scanf("%d%d%d%d%d", &number[0], &number[1], &number[2], &number[3], &number[4]);
for ( i=0 ; i <= 4 ; i++ ) {
if ( number[i] >= max ) {
max = number[i];
}
if ( number[i] <= min ) {
min = number[i];
}
}
printf("Largest integer is %d\n", max);
printf("Smallest integer is %d\n", min);
return EXIT_SUCCESS;
} /* ---------- end of function main ---------- */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment