Computer Science, asked by e20esurupooja, 1 month ago

Ex. No.2:

GREATEST NUMBER USING IF ELSE STATEMENT

AIM:Write another program to check which value is greater 'a', 'b' or 'c'. Hint: use else-if statement. (Take values of a, b, c as user inputs)

ALGORITHM:

1. Start the program.

2. Declare and get the input value of the variables ‘a’,’ b’ and ‘c’.

3. Check the condition using if statement whether ‘a’ is greater than ‘b’.

4. If the condition is true

a. Again the condition is checked whether ‘a’ is greater than ‘c’.

b. Here, if the condition is true again then the statement will be displayed as “A is greater”.

c. If the condition is false the statement will be displayed as “C is greater”.

5. If the condition is false

a. Again the condition is checked whether ‘b’ is greater than ‘c’.

b. Here, if the condition is true then the statement will be displayed as “B is greater”.

c. If the condition is false the statement will be displayed as “C is greater”.

6. End the program.















Flow chart:





PROGRAM:

#include <stdio.h> #include<conio.h> void main()

{

inta,b,c; clrscr(); printf("Enter three numbers: "); scanf("%d %d %d", &a, &b, &c);

if (a>b)

{

if(a>c) printf("%d is the largest number.", a); else

printf("%d is the largest number.", c);

} else

{

if(b>c) printf("% d is the largest number.", b); else

printf("% d is the largest number.",c);

}

getch();

}

OUTPUT:

RESULT:

????​

Answers

Answered by ram08rr
2

Answer:

out

Explanation:

put returns on it and then you will be able to get

Answered by sumansahawb2
0

Answer:

out pls mark me as Brainliest

Similar questions