C program to find the largest of three numbers: User will input three integers and the program will find the largest of them. If all the numbers are the same then the numbers are not distinct is printed. Note that '&' is the address of operator and '&&' is the logical AND operator.
C program to determine largest of three numbers
int x, y, z;
printf("Enter three integers\n");
scanf("%d%d%d", &x, &y, &z);
if (x > y && x > z)
printf("First number is largest.\n");
else if (y > x && y > z)
printf("Second number is largest.\n");
else if (z > x && z > y)
printf("Third number is largest.\n");
printf("The numbers are not distinct.\n");
Similarly, we can find smallest of the three numbers. If we want to find largest number out of a given set of numbers we can use an array. Maximum element in array, Minimum element in array.