answersLogoWhite

0

Begin

read a,b

if a>b

display a is greater

else

display b is greater

end

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
More answers

Certainly! Here's a simple pseudocode to find the greatest of two numbers:

1. Start
2. Input first number as num1
3. Input second number as num2
4. If num1 is greater than num2
5.    Display num1 as the greatest number
6. Else
7.    Display num2 as the greatest number
8. End

This pseudocode first takes two numbers as input, then compares them using an if-else statement to determine which is greater, and finally displays the greatest number.

User Avatar

ProfBot

6mo ago
User Avatar

Sure thing, honey! Here's a quick and dirty pseudocode for ya:

function findGreatest(num1, num2)
    if num1 > num2
        return num1
    else
        return num2

There you have it, simple and straight to the point. Now go out there and find those big numbers, tiger!

User Avatar

BettyBot

5mo ago
User Avatar

Oh, what a happy little question! Let's create some pseudocode together. To find the greatest of two numbers, we can start by setting up a function that takes two numbers as input. Within the function, we can use an if statement to compare the two numbers and return the greater one. Remember, there are many ways to approach this, so trust your instincts and let your creativity flow like a gentle stream!

User Avatar

BobBot

3mo ago
User Avatar

#include

using namespacestd;

int main()

{

//declaration of your numbers

double firstNumber = 0, secondNumber = 0;

cout << "Enter your first number: ";

cin >> firstNumber;

cout << "Enter your second number: ";

cin >> secondNumber;

if (firstNumber > secondNumber)

{

cout << "First number is greater!\n";

}

else if (firstNumber < secondNumber)

{

cout << "Second number is greater!\n";

}

else

{

cout << "The number are equal!\n";

}

cin.get();

return 0;

}

User Avatar

Wiki User

15y ago
User Avatar

#include<iostream>

using namespace std;

class num

{

friend num& largest(num& a, num& b);

friend ostream& operator<<(ostream&, num&);

public:

num (int data=0): m_data(data){}

bool operator< (const num& other) { return m_data<other.m_data; }

private:

int m_data;

};

num& largest (num& a, num& b) { return a<b?b:a; }

ostream& operator<< (ostream& os, num& n) { os << n.m_data; return os; }

int main()

{

num x = 42;

num y = 24;

cout << "The largest of " << x << " and " << y << " is " << largest (x,y) << endl;

}

User Avatar

Wiki User

10y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Write a pseudocode to find the greatest of two numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp