answersLogoWhite

0


Best Answer

1. Read the 3 nos a,b,c

2. Let larget = a

3. if b > largest then largest = b

4. if c > largest then largest = c.....

If you have to process more nos, read all of them in an array. Assume the first element be largest, do comparison through all elements of the array....

Similar algorithm can be developed for finding the lowest also.

/*lab practice 2 damithguruge question 4 */

#include<stdio.h>

int main()

{

int num1,num2,num3,num4;

int smallest;

printf("Please enter a number1");

scanf("%d%*c", &num1);

printf("Please enter a number2");

scanf("%d%*c" ,&num2);

printf("Please enter a number3");

scanf("%d%*c", &num3);

Printf("Please enter a numbe4r");

scanf("%d%*c", &num4);

/* num1 set as the smallest */

smallest=num1;

if(smallest > num2) then

smallest=num2;

else

if smallest >num3 then

smallest=num3;

else

if smallest>num4 then

smallest=num4;

printf("smallest number:%d\n,smallest");

return(0);

endif

endif

endif

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write algorithm of a largest number in three numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position?

please give me an algorithm and a corresponding flow chart that displays list of numbers from 1 to 20.


Write algorithm compute sum of square of N numbers?

1. Design an algorithm to compute sum of the squares of n numbers?


What are the characteristics of an algorithm. Describe with an example?

An algorithm is a stepwise sequence of operations that can be performed to solve a problem. The operations are expected to be 'simple', so they can be performed mechanically.A simple example algorithm is "how to find the largest number in a list of numbers":- look at the first number and write it down as the largest-so-far- for each remaining number in the list:- - replace largest-so-far with this number if this number is larger- when you have compared all the numbers, largest-so-far is the largest number in the listA less trivial algorithm is the one people learn in school for multiplying multi-digit numbers, called "long multiplication" or "grade-school multiplication". It becomes rather long if you write down all the steps (as you would need to for an algorithmic description), but it involves multiplying each digit in the first number with each digit in the second number and summing the partial results.Here the simple operation is multiplying two single digits, which you are expected to know how to do, and by using the algorithm you can extend the knowledge of how to multiply single digits to multiply numbers with any number of digits.See related links.


Write algorithm and draw flowchart to find the sum of even numbers?

jgfujtf


How can you write an algorithm for getting autoformic numbers?

Perhaps you mean an automorphic number? Loop through a series of numbers - for example, all numbers from 1 to 10,000 - and check each of the numbers, whether the condition applies. The condition in this case is that if you square the number, the last digits represent the original number.

Related questions

Write an algorithm to check whether a number is a prime number or not?

You can write out this algorithm. This will then be programmed into the device to make determining prime numbers easier.


Write a algorithm and flowchart to find largest among N numbers?

Max = 0For K = 1 to NIf Number(K) > Max then Max = Number(K)Next KPrint Max


How to write an algorithm that accepts five numbers and displays the sum and average of the numbers?

1.Start Algorithm 2.Enter first number 3.Enter second number 4.Enter third number 5.Enter fourth number 6.Enter fifth number 7.Add five number 8.display five number / 2 9.Display result 10.End Algorithm


Can you write an algorithm to find the beast numbers?

maybe


Write an algorithm and draw a corresponding flowchart to search a number in the given list of numbers and also display its position?

please give me an algorithm and a corresponding flow chart that displays list of numbers from 1 to 20.


Write algorithm compute sum of square of N numbers?

1. Design an algorithm to compute sum of the squares of n numbers?


What are the characteristics of an algorithm. Describe with an example?

An algorithm is a stepwise sequence of operations that can be performed to solve a problem. The operations are expected to be 'simple', so they can be performed mechanically.A simple example algorithm is "how to find the largest number in a list of numbers":- look at the first number and write it down as the largest-so-far- for each remaining number in the list:- - replace largest-so-far with this number if this number is larger- when you have compared all the numbers, largest-so-far is the largest number in the listA less trivial algorithm is the one people learn in school for multiplying multi-digit numbers, called "long multiplication" or "grade-school multiplication". It becomes rather long if you write down all the steps (as you would need to for an algorithmic description), but it involves multiplying each digit in the first number with each digit in the second number and summing the partial results.Here the simple operation is multiplying two single digits, which you are expected to know how to do, and by using the algorithm you can extend the knowledge of how to multiply single digits to multiply numbers with any number of digits.See related links.


Write an algorithm to find the largest number amongst three numbers and draw a flowchart?

Step1- Read a,b,c. Step2-if a&gt;b continue step 5. Step3- b&gt;c then print “b is the largest &quot; and continue step 7. Step4- continue step 6 Step5-if a&gt;c then print “a is the largest &quot; then continue step7. Step6- print “z is largest&quot;. Step7- end.


What is the largest six digit number you can write using the numbers 381724?

874321 is the largest number made from all these digits.


Write algorithm and draw flowchart to find the sum of even numbers?

jgfujtf


Write an algorithm to read two numbers then display the largest?

Read 2 numbers. If first is larger than second, display second, else display first. That's for the smallest. For the largest reverse the two. For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest. Best answer Read 2 numbers. If first is larger than second, display second, else display first. That's for the smallest. For the largest reverse the two. For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest.


How can you write an algorithm for getting autoformic numbers?

Perhaps you mean an automorphic number? Loop through a series of numbers - for example, all numbers from 1 to 10,000 - and check each of the numbers, whether the condition applies. The condition in this case is that if you square the number, the last digits represent the original number.