Wednesday, November 3, 2021

Largest of Three Numbers in C

 A simple program that will ask the user to give three numbers and then the program will check and determine which of the three given numbers has a largest numerical value.

  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.




Program Listing

/* largest.c

   Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

   jakerpomperada.blogspot.com  and jakerpomperada.com

   jakerpomperada@gmail.com

   Bacolod City, Negros Occidental Philippines

*/


#include <stdio.h>


int main()

{

    int val_1=0, val_2=0, val_3=0;

    int largest = 0;

        

    printf("\n\n");

    printf("\tLargest of Three Numbers in C");

    printf("\n\n");

    printf("\tGive First Value  : ");

    scanf("%d", &val_1);

    printf("\tGive Second Value : ");

    scanf("%d", &val_2);

    printf("\tGive Third Value  : ");

    scanf("%d",&val_3);

    

    largest =((val_1>val_2 && val_1>val_3)?val_1:(val_2>val_3)?val_2:val_3);

    

    printf("\n");

printf("\tThe Largest Number is %d.",largest);

printf("\n\n");

    printf("\tEnd of Program");

    printf("\n");


}








No comments:

Post a Comment