Minimum and maximum out of 3 values in c programming

Minimum and maximum out of 3 values in c programming

In this post we will show you how to Find Minimum and maximum out of 3 values in c programming. flowing code will help you to perform program.

 // include header file 
# include <stdio.h>
# include <conio.h>
// main function
void main()
{
	int x,y,z;
	clrscr();
	
    // insert number
	printf("Enter X: ");
	scanf("%d",&x);
	printf("Enter Y: ");
	scanf("%d",&y);
	printf("Enter Z: ");
	scanf("%d",&z);

	// check maximum numbers
	// and print result
	if(x>y)
	{
		if(x>z)
		  printf("\n\nX is Maximum.");
		else
		  printf("\n\nZ is Maximum.");
	}
	else if(y>z)
	  printf("\nY is Maximum.");
	else
	  printf("\nZ is Maximum.");

	// check minimum numbers
	// and print result
	if(x<y)
	{
		if(x<z)
		  printf("\nX is Minimum.");
		else
		  printf("\nZ is Minimum.");
	}
	else if(y<z)
	  printf("\nY is Minimum.");
	else
	  printf("\nZ is Minimum.");
	  
	getch();
}

Leave a Comment

Your email address will not be published. Required fields are marked *

54  +    =  62

We accept paid advance and paid guest Posting on our Site : Contact US