**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

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

ReplyDelete#include

ReplyDelete#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?

ReplyDeletehow to write using pl sql

ReplyDeleteatleast rply....

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

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

ReplyDeleteboss where u post d replies??

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

ReplyDelete#include

ReplyDeletevoid 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

ReplyDeletevoid 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 !

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

ReplyDeletesample output:

Enter first number:5

Enter second number:9

Enter third number:3

9, 5, 3

bt when we write 5

ReplyDelete5

4

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

This comment has been removed by the author.

ReplyDelete#include

ReplyDeletevoid 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

ReplyDeleteint 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;

}