answersLogoWhite

0


Best Answer

Begin

read a,b

if a>b

display a is greater

else

display b is greater

end

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

ProfBot

1h ago

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.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

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

}

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

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

}

This answer is:
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
Related questions

write a pseudocode to accept a number and find if it is prime or not?

Yes


Write the Pseudocode to find the factorial of a number?

Pseudo code+factorial


How do i write an algorithm using pseudocode especially when it concerns salary and net salary?

to find area and perimeter of a rectangle


Write the prime factorization using exponents of each number then find the greatest common factor of the numbers 12 and 15?

2.2.3 and


How could you use a Venn Diagram to help find the greatest common factor of two Numbers?

Write the factors of the first number in the left circle. Write the factors of the second number in the right circle. Write the numbers that are the same in each individual circle in the space where they intersect.


Can you find the greatest common multiple of two numbers?

The greatest common multiple of any two numbers is infinite.


Where can one find information on Pseudocode?

One can find information about Pseudocode online in various websites. Some of them include the following: Wikipedia, Stack Overflow or Stack Exchange.


What is the greatest common factor of 400?

You need at least two numbers to find a GCF.


Why can't you find the greatest common multiple in a group of numbers?

You can't find the greatest common multiple in any amount of numbers, the number would be infinite.


Pseudocode to find the even numbers between 1 to 100?

One way to write pseudocode to find even numbers between 1 to 100 is as follows: Initialize a variable, let's say &quot;num,&quot; to represent each number from 1 to 100. Use a loop structure to iterate through each number from 1 to 100. Within the loop, use an &quot;if&quot; statement to check if the current number is divisible by 2 (i.e., if num modulo 2 equals 0), and if it is, then output or store that number as an even number. This pseudocode will help you identify and list all even numbers between 1 to 100 systematically.


How do you find the greatest common multiple of 2 numbers?

Relax. There is no such thing as the "greatest" one.


How. to. write an. algorthim. to find the. sum of. first. 15 natural. numbers?

Write an. Algorthim. To. Find the. Sum. Of. First15 natural. Numbers