what is an algorithm for a program that reads 4 integers (not in array) and print them without using loop

Zaina jee
Recommended Answers
Jump to PostWell, you could use if-else if-else statements, but it will be a very long & messy code because of the permutation of the value in each variable.
Jump to PostPsuedo codeish:
Get four numbers: a, b, c, d
if a is greater than b, swap a and b
if b is greater than c, swap b and c
if c is greater than d, swap c and d
if a is greater than b, swap a and b
if …
All 5 Replies
Taywin 312 Posting Virtuoso
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Momerath 1,327 Nearly a Senior Poster Featured Poster

Zaina jee
jllany.anthony 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.