Find the largest number among three numbers with C language
#include <stdio.h>
int main()
{
int x, y, z;
printf("Enter three values: ");
scanf("%d %d %d", &x, &y, &z);
if (x > y && x >z )
{
printf("%d is the largest value.", x);
}
else if (y > x && y > z)
{
printf("%d is the largest value.", y);
}
else if (z > x && z > y)
{
printf("%d is the largest value.", z);
}
return 0;
}
Output:-
Enter three values : 4 8 6
8 is the largest value.
0 Comments