**Find the greatest number in given three numbers**

#include<stdio.h>

int main(){

int a,b,c,big;

printf("\nEnter
3 numbers:");

scanf("%d %d
%d",&a,&b,&c);

big=(a>b&&a>c?a:b>c?b:c);

printf("\nThe
biggest number is:%d",big);

return 0;

}

**C program for largest of 3 numbers**

**Write a c program to find largest of three numbers**

#include<stdio.h>

int main(){

int a,b,c;

int big;

printf("Enter any there numbers: ");

scanf("%d%d%d",&a,&b,&c);

if(a>b && a>c)

big = a;

else if(b>c)

big = b;

else

big = c;

printf("Largest number is: %d",big);

return 0;

}

Sample output:

Enter any there numbers: 13 25 6

Largest number is: 25

## 27 comments:

how to find biggest of three nnumbers using macros,that is using #define preprocessor.

#include

#define max(a,b,c) (a>b&&a>c?a:b>c?b:c)

int main()

{

printf("Enter three numbers:");

scanf("%d %d %d",&a,&b,&c);

printf("Greatest of three number is : %d",max(a,b,c));

return 0;

}

how to write using the header file iostream only?

how to write using pl sql

atleast rply....

Write a program that accepts five numbers from the user and displays the highest and lowest number. Assume that there are no duplicate values.

how can we write the logic of finding d greatest numbers among three in a single if statement..pls suggest

boss where u post d replies??

Hey guys if I want to dis same without ternary operator that to in single if statement plz rply plz

#include

void main()

{

int a,b,c,l;

clrscr();

printf("Enter three numbers...");

scanf("%d%d%d",&a,&b,&c);

l=a;

if(l<b)

{

l=b;

}

if(l<c)

{

l=c;

}

printf("greatest among given three numbers is %d",l);

getch();

}

#include

void main()

{

int a,b,c;

int biggest;

printf("Enter 1st Number: ");

scanf("%d", &a);

printf("Enter 2nd Number: ");

scanf("%d", &b);

printf("Enter 3rd Number: ");

scanf("%d", &c);

if(a > b)

{

if(a > c)

biggest = a;

else

biggest = c;

}

else

{

if(b > c)

biggest = b;

else

biggest = c;

}

printf("Biggest of 3 numbers is: %d\n", biggest);

}

v.good !

please give me an example program that will print the 3 numbers from highest to lowest.

sample output:

Enter first number:5

Enter second number:9

Enter third number:3

9, 5, 3

bt when we write 5

5

4

so ans is 4 bt it is smaller so please check it

#include

void main()

{

int x,y,z,max;

printf("Enter three numbers\n");

scanf("%d%d%d", &x, &y, &z);

if (x>y) max=x;

else max=y;

if (z>max) max=z;

printf("Max = %d\n", max);

}

#include

int main()

{

float a, b, c;

printf("Enter three numbers: ");

scanf("%f %f %f", &a, &b, &c);

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

printf("Largest number = %.2f", a);

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

printf("Largest number = %.2f", b);

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

printf("Largest number = %.2f", c);

return 0;

}

in c++ we can use this code

#include

#include

void main()

{clrscr();

int a,b,c,greatest;

cout<<"ENTER THE VALUE FOR A,B,C:";

cin>>a>>b>>c;

greatest=a>b&&a>c?a:(b>c?b:c);

cout<<"the greatest no is="<<greatest;

}

can also use this:

void main()

{

int a,b,c,big;

printf("enter 3 numbers:");

scanf("%d %d %d",&a,&b,&c);

big=(a>b)?(a>c)?a:c:(b>c)?b:c;

printf("%d is the biggest number",big);

getch();

return 0;

}

Thank you abi.This is very useful to know better about conditional operators.

thank yu dear it was helpful

how to use both inline and macros function in program to find largest n three numbers

Guys plz help me to find minimum of 3 numbers using conditional operators

Ya correct vgood

Ya correct vgood

To find greatest among three using logical or

Post a Comment