Write A Program In "C" To Find Out Greatest Of Three Numbers?

6

6 Answers

Anonymous Profile
Anonymous answered
#include
#include
void main()
{
clrscr();
int a,b,c;
printf("nt Enter the first number : ");
scanf("%d",&a);
printf("nt Enter the second number : ");
scanf("%d",&b);
printf("nt Enter the third number : ");
scanf("%d",&c);
if(a>b && a>c)
printf("nt The greatest number is : %d ",a);
if(b>a && b>c)
printf("nt The greatest number is : %d ",b);
if(c>a && c>b)
printf("nt The greatest number is : %d ",c);
getch();
}
Anonymous Profile
Anonymous answered
#include
#include
void main()
{
clrscr();
int a,b,c;
printf("Enter any three numbers:");
scanf ("%d%d%d",&a,&b,&c);
if (a>b && a>c)
{
printf("a is biggest");
}
else if (b>a && b>c)
{
printf("b is biggest");
}
else
printf ("c is biggest");
getch();
}
Anonymous Profile
Anonymous answered
Mesak Lawmkima, Jr.Technician(Software) - Member of Faculty, ZENICS Computer Academy, Aizawl, Mizoram
#include
void main()
{
int x, y, z;
clrscr();
printf("Enter any three numbers : ");
scanf("%d %d %d", &x, &y, &z)
if(x>y>z)
{
printf("The first number is greatest");
}
if(y>z>x)
{
printf("The second number is greatest");
}
if(z>x>y)
{
printf("The third number is greatest");
}
getch();
}
Anonymous Profile
Anonymous answered
#include
#include
main()
{
   int a,b,c;
printf ("/n enter the a,b,and c values");
scanf ('/n %d %d %d",&a,&b and&c);
if (a>b)&&(b>c)
printf ("a" value is large);
if(b>a)
printf ("b" value is large);
else
printf ("c" value is large);
}
Anonymous Profile
Anonymous answered

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

void main()

{

clrscr();

int a,c,b;

cout<<"enter three numbers";

cin>>a;

cin>>b;

cin>>c;

if(a>b && a>c)

{

cout<<a<<"is the greatest of all"<<endl;

}

else if(b>a && b>c)

{

cout<<b<<"is greatest of all"<<endl;

}

else if(c>a && c>b)

{

cout<<c<<"is greatest of all"<<endl;

}

getch();

}

Alongbar Daimary Profile
Here is the gretest of three numbers. And yes if you need for more numbers just increase SIZE, no more changes needed.  #include<stdio.h> #include<conio.h> #define SIZE 3  void main() { int Nums[SIZE], I,Greatest=0; printf("Enter three numbers: "); for(I=0;I<SIZE;I++) scanf("%d",&Nums[I]);  for(I=0;I<SIZE;I++){ if (Greatest<Nums[I]) Greatest=Nums[I]; } printf("Greatest number is:t %d",Greatest); getch(); }

Answer Question

Anonymous