please dont rip this site

Language Ccpp Cref Problems Numtest.c

/ **************************************************************************
 *
 * Purpose: find the smallest and largest numbers from a sequence of numbers.
 * to do:   Change it so it will take any number of numbers from the keyboard.
 * Author:  M. J. Leslie
 * Date:    04-Apr-94
 *
 **************************************************************************/

#include <stdio.h>

#define MAX_NUM 4

float bignum   (float, float);
float littlenum(float, float);

main()
{
float numbers[MAX_NUM]= {0};
float biggest=0, littlest=999;
int count;

puts("Please enter 4 numbers");
scanf("%f %f %f %f", &numbers[0], &numbers[1], &numbers[2], &numbers[3]);                         

for (count = 0; count < MAX_NUM; count++)
   {
   biggest  = bignum(numbers[count], biggest);
   littlest = littlenum(numbers[count], littlest);
   }
printf("Biggest number is %f\n",  biggest);
printf("Littlest number is %f\n", littlest);
}

float bignum( float num1, float num2)
{
if ( num1 > num2)
   return num1;
else
   return num2;
}

float littlenum( float num1, float num2)
{
if ( num1 < num2)
   return num1;
else
   return num2;
}


file: /Techref/language/ccpp/Cref/PROBLEMS/numtest.c, 1KB, , updated: 1997/4/21 08:53, local time: 2024/12/22 22:45,
TOP NEW HELP FIND: 
3.144.28.90:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/ccpp/Cref/PROBLEMS/numtest.c"> language ccpp Cref PROBLEMS numtest</A>

Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .