Machine Problem

Write a program that will ask the user to give three numbers and then the program will check and evaluate which of the three numbers is the highest, middle and the lowest number using functions.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================



Want to support my channel?

GCash Account

Jake Pomperada


09173084360



Paypal

https://paypal.me/jakerpomperada



Patreon

https://www.patreon.com/jakerpomperada

Thank you very much for your support.


Program Listing
/* numbers.c
   Author    : Mr. Jake Rodriguez Pomperada,BSCS,MAED-IT
   Date      : November 28,2018  Wednesday  3:13 PM
   Location  : Bacolod City, Negros Occidental Philippines.
   Website  : http://www.jakerpomperda.com 
   Emails   : jakerpomperada@jakerpomperada.com and jakerpomperada@gmail.com
*/  
#include <stdio.h>
// function prototype declaration  
int high_number(int,int,int);

int main() {
int a=0,b=0,c=0;
printf("\n\n");
printf("\tHigh, Middle and Low Number in C");
printf("\n\n"); 
printf("\tEnter First Number  : ");
scanf("%d",&a);
printf("\tEnter Second Number : ");
scanf("%d",&b);
printf("\tEnter Third Number  : ");
scanf("%d",&c);    
high_number(a,b,c);
}
/* function high_number */
int high_number(int value1,int value2, int value3) {
  int high_value=0,low_value=0,middle_value=0;
   /* Check For Higher Number */
  if (value1 >= value2 && value1 >= value3) {
        high_value = value1;
    }
    else if (value2 >= value1 && value2 >= value3) {
        high_value = value2;
    }
    else if (value3 >= value1 && value3 >= value2) {
        high_value = value3;
    }

/* Check For Low Number */
  if (value1 <= value2 && value1 <= value3) {
        low_value = value1;
    }
    else if (value2 <= value1 && value2 <= value3) {
        low_value = value2;
    }
    else if (value3 <= value1 && value3 <= value2) {
        low_value = value3;
    }

 /*Check For Middle Value */
   if (value1 <= value2 && value1 >= value3 ) 
         {
        
        middle_value = value1;
    }
else  if (value2 <= value1 && value2 >= value3) 
      
         {
        
        middle_value = value2;
    }
else  if (value3 <= value1 && value3 >= value2) 
         {
        
        middle_value = value3;
    }

/* Code for check all the possible arrangement of values */
 /* Check for first value   */
else  if (value1 >= value2 && value1 <= value3) 
         {
       middle_value = value1;
    }
 /* Check for second value  */  
else  if (value2 >= value1 && value2 <= value3) 
         {
    
        middle_value = value2;
    }
 /* Check for third value */   
else  if (value3 >= value1 && value3 <= value2) 
         {
  middle_value = value3;
    }
printf("\n\n");
printf("\t===== DISPLAY RESULT =====");
printf("\n\n");
printf("\t%d is the Biggest number.",high_value);
printf("\n");
printf("\t%d is the Middle number.",middle_value);
printf("\n");
printf("\t%d is the Lowest number.",low_value);
printf("\n\n");
printf("\tEnd of Program");
printf("\n\n"); 
}

Leave a Reply

Your email address will not be published.