Find maximum of three numbers

Program:

#include<stdio.h>
int main()
{
int x,y,z;
printf("Enter three numbers: \n");
scanf("%d %d %d",&x,&y,&z);
if(x>y)
{
if(x>z)
{
printf("%d is maximum number",x);
}
else
{
    printf("%d is maximum number",z);
}
}
else
{
if(y>z)
{
printf("%d is maximum number",y);
}
else
{
    printf("%d is maximum number",z);
}
}
return 0;

}

Output:



No comments:

Post a Comment

x^y using recursion

Program: #include<stdio.h> int power(int a,int b); int main() { int x,y,ans; printf("Enter x and y:\n "); scanf(...