Max = 0
For K = 1 to N
If Number(K) > Max then Max = Number(K)
Next K
Print Max
Chat with our AI personalities
Oh, what a lovely question! Let's create a simple algorithm together. We can start by setting a variable to store the largest number, then we'll compare each number in the list to this variable. If a number is larger, we'll update the variable. We can continue this process until we've checked all the numbers, and then the variable will hold the largest number. Remember, there are many ways to approach this, so feel free to let your creativity shine through in your flowchart!
Step1- Read a,b,c. Step2-if a>b continue step 5. Step3- b>c then print “b is the largest " and continue step 7. Step4- continue step 6 Step5-if a>c then print “a is the largest " then continue step7. Step6- print “z is largest". Step7- end.
Sure, honey. First, let's keep it simple. To calculate the perimeter of a square, you just need to multiply the length of one side by 4. So, if the side length is "s", the formula is 4s. As for the flowchart, draw a square with "s" labeled on one side, then an arrow pointing to a box that says "Perimeter = 4s". Done and done, darling.
Start print "the sum of all even numbers is infinite" end
You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.
just go the reverse of how they are listed now they are currently largest to smallest