0% found this document useful (0 votes)
9 views

Exp2 2app

The program takes in 3 numbers from the user and determines whether they are in ascending or descending order. It assigns the numbers to variables for ascending and descending order, then checks if the first number is greater than or equal to the third number. If so, it displays the numbers in ascending order as the third, first, and second numbers. Otherwise, it checks if the third number is less than or equal to the first number and displays the numbers in descending order as the second, first, and third numbers.

Uploaded by

Siegfred Laborte
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Exp2 2app

The program takes in 3 numbers from the user and determines whether they are in ascending or descending order. It assigns the numbers to variables for ascending and descending order, then checks if the first number is greater than or equal to the third number. If so, it displays the numbers in ascending order as the third, first, and second numbers. Otherwise, it checks if the third number is less than or equal to the first number and displays the numbers in descending order as the second, first, and third numbers.

Uploaded by

Siegfred Laborte
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Experiment 2.2 Flowchart; Algorithm; 1. Enter three numbers 2. Let ascending=a,b,c descending=c,b,a 3.

If a>=c, display the ascending order is c,a,b else if c<=a, display the descending order b,a,c. START

Enter three numbers;

Program; #include<stdio.h> #include<conio.h> int main() { int a,b,c, ascending, descending; printf("Enter Three Numbers:"); scanf("%d %d %d", &a, &b, &c); ascending=a, b, c; descending=c, b, a; if (a>=c) printf("The Ascending Order: %d, %d, %d", c, a, b); else (c<=a); printf("\nThe Descending Order: %d, %d, %d", b, a, c); getch(); return 0; }

Ascending=a,b,c Descending=c,b,a

Is a>=c?

Displayascending Order is c,a,b

Is c<=a

Display descending Order is b,a,c

END

You might also like