-->
Showing posts with label greatest number among three number. Show all posts
Showing posts with label greatest number among three number. Show all posts

program to get greatest number among three numbers

// program to get greatest number among three numbers
#include<stdio.h>
#include<conio.h>
void main()
{
float a,b,c;
printf(“enter three numbers\n”);
scanf(“%f%f%f”,&a,&b,&c);
if(a>b &&a>c)
{
printf(“the greatest number=%f\n”,a);
}
elseif(b>a &&b>c)
{
printf(“the greatest number=%f\n”,b);
}
else
{
printf(“the greatest number=%f\n”,c);
}
getch();
}

Write a program to get greatest number among three numbers.

//a program to get greatest number among three numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z;
printf("enter  numbers\n");
scanf("%d%d%d",&x,&y,&z);
if(x>y && x>z)
{
printf("x is greatest");
}
elseif(y>x && y>z)
{
printf("y is greatest\n");
}
else
{
printf("z is greatest");
}
getch();
}