Ilya Mikhelson 434,614 views. In this tutorial we will assume that you know how to create vectors and matrices, know how to index into them, and know about loops. The following example script creates a vector containing the areas of circles with radii 1 through 4 using a while loop. Asked by matlab on my older work machine when I make Matlab do extra work. $\begingroup$ I got it, so stupid. e --> Row1: [4,12,13,15,16,18,19,20,22,24,27]. count-controlled loops. Armed with this knowledge, you can compute all or some particular root. reset the counter in for loop. In while and dowhile loops we need to write the increment or decrement operation to break the loop after sometime. INTRODUCTION In this lecture we will discuss about another flow control method - Loop control. A nested loop is a loop inside a loop. A loop statement allows us to execute a statement or group of statements multiple times. In the tutorial, students will solve the problem of finding the closest meet-up location on a map by creating an algorithm. Depending on the condition, the task may not be performed at all. As said before (after the for loop. efficiently in Matlab without loops. Sharpen your programming skills while having fun!. Even apparently conservative and usefull functions remain outside the scope of Alexandria if they cannot be implemented portably. init counter: Initialize the loop counter value; test counter: Evaluated for each loop iteration. MATLAB Central. For instance, this example blinks 6 LEDs attached to the Arduino or Genuino by using a for() loop to cycle back and forth through digital pins 2-7. Your Assignment. If the loop counter has not exceeded the upper limit, in this case 10, Matlab returns to the top of the loop and executes the Code statements again. 2*exp(i*pi/3) or: 1 + 1. In the following examples we will see how this is implemented in Matlab, but nevertheless how good programmers we are, some mistakes will happen. Recreate the functionality of a for loop using a while loop. Program is a generalized one and takes objective function as user input in terms of standard MATLAB function, e. I tried some vectorization but for nested loops things get really complicated, especially with different loop sizes. See the previous section for that. The full question is: Write 4 lines of code to use a forloop in the variable i to calculate and store the values of t and h=(3+t)t. In MATLAB, we instruct the computer to repeat a block of code by using a for loop. GIF animations can be set to loop (repeat the animation) forever, or for any number of predefined times. Jan 16, 2019 · If o set it to 2 the counter will change its value in steps of 2 as you will see shortly, once the model of the up counter is complete. Can I increase an additional counter inside the genetic algorithm optimization loop (using the ga optimtool MATLAB tool)? (as a counter) instead of just represent it in the Command Window. That tutorial was linked to at the top of this thread, for everyone to read. Then the while loop will run if the variable counter is smaller then the variable "howmuch". If and only if a particular value is prime, then we’ll add it to our running total. counter = 0 while counter = 100: print counter counter + 2 Nested Loops In some script you may want to use nested loops. Then it will calculate c(1), at the end it will go back to calculate c(2), and then go back and calculate c(3) and stop. This way is a bit longer, so if you definitely know how many times you will need to do some commands, use for -loop. The drawing shows the general form of a loop statement for most programming languages. Or when the loop counter is not sufficient as. MATLAB - The for Loop - A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. In Matlab a common programming construction is a if or a switch statement. See the previous section for that. Avoid assigning a value to the index variable within the loop statements. I have a matrix which could be of any dimension. where y(0) = 0 and x(k) is in my case a unit step function ie = 1 well, i'm trying to solve this using a for loop, but am having some trouble. This is less like the for keyword in other programming languages, and works more like an iterator method as found in other object-orientated programming languages. There are two main ways of doing this: for loops and while loops. Oct 10, 2017 · How to count if loops. m) Use "for" loop if you know how many time you want to. In Matlab, you don't need the "by_count" value if you want the default of counting by 1. Or when the loop counter is not sufficient as. Can I increase an additional counter inside the genetic algorithm optimization loop (using the ga optimtool MATLAB tool)? (as a counter) instead of just represent it in the Command Window. An index into a list. There are two types of loops: for statements loop a specific number of times, and keep track of each iteration with an incrementing index variable. If cond-expression is omitted, it is considered true and the for loop will not terminate without a break, return, or goto within statement. MATLAB is a high-level programming language that does not require managing memory details. Use a for loop to calculate Cp for each time increment and add drug dosages at the appropriate times. MATLAB Programming I - Conditionals and Loops Programming in MATLAB Step 1: Create a m-file (xxx. The advantage to a for loop is we know exactly how many times the loop will execute before the loop starts. The programming structures presented below apply to MATLAB. (There is actually no distinction in Matlab. Homework Statement Write an m-file to evaluate y(x)= x^2 - 3x +2 for all values of x between -1 and 3, in steps of. Then the second pass of the outer loop triggers the inner loop again. For some values of c the iteration will go on forever if we let it. Jan 15, 2009 · Remember that in Matlab an n x 1 vector is different from a 1 x n vector, so even for vectors you should have Matlab provide you with both the number of rows and the number of columns. Repeat one or more statements for a fixed number of times. loop and if conditions for calculating average. 19 In Two Ways: (a) Write A Script File That Evaluates The Product Of The First 10 Odd Numbers. Your Help Needed If you know MATLAB , please write code for some of the tasks not implemented in MATLAB. In the following examples we will see how this is implemented in Matlab, but nevertheless how good programmers we are, some mistakes will happen. 5x improvement for a sum of squared differences (SSD) in an image processing algorithm and a 6x speed improvement for a noise reduction using a. Notice: Weird same counter nested loops. count is the number of iterations performed Saving and ruunning the program. The question is worded as such: The counter in a for or while loop can be given explicit increment: for i =m:k:n to advance the counter i by k each time. for loop, especially nested for loops since these can make a Matlab programs run time orders of magnitude longer than may be needed. However, Matlab cannot parallelize a loop variable whos value depends on the iteration order. Learn more about for loop, while loop. How this works is that the first pass of the outer loop triggers the inner loop, which executes to completion. TBD: Build a matrix using a nested for loop: forloops_buildmatrix1. The for statement overrides any changes made to index within the loop. Loops/For with a specified step You are encouraged to solve this task according to the task description, using any language you may know. Brian Vick Mechanical Engineering Department Virginia Tech General Purpose Commands Operators and Special Characters / 3 Commands for Managing a Session / 3 Special Variables and Constants / 4 System and File Commands / 4 Input/Output and Formatting Commands Input/Output Commands / 5. Recreate the functionality of a for loop using a while loop. bmp, all saved in a folder called. for Loops ME 352, Fall 2007 page 1/3 A Quick Introduction to Loops in Matlab Loops are used to repeat sequences of calculations. You better not use FOR loop. Lot of times, we come across situations, where we need to save the data or read the data generated from the experimental simulation to an Excel file. In the examples of for loops, what was the looping variable often used for? Storing the results of a calculation inside the loop. Arrays in MATLAB obey the same rule as their mathematical counterpart: by default, the matrix definitions of operations are used, unless a special operator called the dot operator is applied. Don't like this video? Sign in to make your opinion count. The integer is called a loop control variable. In while and dowhile loops we need to write the increment or decrement operation to break the loop after sometime. INTRODUCTION TO FOR AND WHILE LOOPS IN MATLAB For loops and while loops allow the computer to run through a series of commands, repeatedly. The for statement overrides any changes made to index within the loop. Note that there is a while loop (inside some for loops) that tests whether the complex number z has modulus less than 2: while (count < maxcount) & (abs(z) < 2) endwhile The first condition in the while loop checks that we do not perform too many iterations. If at any time you wish to see the contents of a variable, just type its name. You can try changing the simulation settings so Simulink only calculates one iteration or just decimate the matrix in matlab. That's not an efficient way. The following example script creates a vector containing the areas of circles with radii 1 through 4 using a while loop. If you inadvertently create an infinite loop (that is, a loop that never ends on its own), stop execution of the loop by pressing Ctrl+C. From 'control structures' to home. With loop control statements, you can repeatedly execute a block of code. The while Loop and Practice Problems Use To repeat execution of a statement or group of statements as long as a specified condition is satisfied. , work in MATLAB, you will be well-prepared for beginning programming in other languages as well. Learn more about cell arrays, unit commitment, length of array, economic dispatch, unitcommitment runtime calculation. Why For Loops? Like all loops, "for loops" execute blocks of code over and over again. As far as I know the matlab for-loop works similar to the for_each-loop that can be seen in many programming languages these days, or maybe the range-for in c++11. m trajectory_theta. If you have a loop that is meant to go through a pre-determined number of iterations, and you have set up a loop counter to count the iteration you are on:. -While loops will jump to the evaluation of the loop condition. Functions showing input/output in MATLAB counter. MATLAB Answers. A sample for loop has the following form: for counter = 1:1:10. Repeating then means looping or cycling a process usually with the objective of approaching a desired goal or target. continue skips the remaining instructions in the while loop and begins the next iteration. The program continues execution from the next iteration. one counter is sufficient already. In this tutorial you will learn how to use three control-flow statements for MATLAB programs, • the for loop, for repeating a statement or group of statements a fixed number of times, • the while loop, for repeating a statement or group of statements an indefinite number of times while a condition remains true, and • the if-elseif-else. Following section shows few examples to illustrate the concept. 24 counter in a loop for 24 images than 24 separate figures get opened. Using stateflow is an easier alternative if you do not wish to use the function block wherein you can write an m-script for the same. Brian Vick Mechanical Engineering Department Virginia Tech General Purpose Commands Operators and Special Characters / 3 Commands for Managing a Session / 3 Special Variables and Constants / 4 System and File Commands / 4 Input/Output and Formatting Commands Input/Output Commands / 5. Count the number of lines of code in the file magic. Matlab Loops. Lot of times, we come across situations, where we need to save the data or read the data generated from the experimental simulation to an Excel file. A for loop is built in order to easily loop through a range of numbers (or as we will see in a later lesson, any list of data). rotating a 2d shape. both the syntax and the semantics differs from one programming language to another. For Loop Iteration (aka The Knight Rider) Often you want to iterate over a series of pins and do something to each one. The integer is called a loop control variable. Start studying for loop quiz. Use a for loop to calculate Cp for each time increment and add drug dosages at the appropriate times. Creating a While Loop. I want to learn how to input a bunch of numbers into a loop and use the counter to find how many "count numbers" I get for that input. We will be glad to help!. for Loops ME 352, Fall 2007 page 1/3 A Quick Introduction to Loops in Matlab Loops are used to repeat sequences of calculations. Loops/For with a specified step You are encouraged to solve this task according to the task description, using any language you may know. In general, when the loop begins, you do not know how many times it will repeat. Jason, you should have tagged it as homework. Pixel counts on matlab image analysis in your count lines. Ilya Mikhelson 434,614 views. ARCHIVE! Please read /mac/00introduction if you haven't already done so. The example below displays the numbers from 0 to 10:. In this tutorial we will assume that you know how to create vectors and matrices, know how to index into them, and know about loops. 19 In Two Ways: (a) Write A Script File That Evaluates The Product Of The First 10 Odd Numbers. Question: Use The Matlab To Do The Questions The Counter In A For Or While Loop Can Be Given Explicit Increment: For I =m:k:n To Advance The Counter I By K Each Time. In each iteration of the for-loop, the variable Counter will take one of the values of i. Sign in to make your opinion count. Real programming Previous: 6. of what is inside the loop, but I will stick to the former, more strict denition. MATLAB likes to do this and will tell you what it has produced after an assignment statement unless you request otherwise. The above chart is a "For Loop. On the last pass of the loop, n will be 1000 and Count will be 499500 (I actually ran the above script in Matlab). The for statement also has another form designed for iteration through Collections and arrays This form is sometimes referred to as the enhanced for statement, and can be used to make your loops more compact and easy to read. Compute the value for y after 10 iterations. A problem with this is that, if you need to parallelize something in the first place, it's typically something that takes a really long time to run. Python For Loops. MATLAB - The Nested Loops - MATLAB allows to use one loop inside another loop. In Matlab, you don't need the "by_count" value if you want the default of counting by 1. A loop that'll never end is called an infinite loop, and it's a feature only of while loops in MATLAB because that's the only place it can happen. With loop control statements, you can repeatedly execute a block of code. MATLAB Central. Define starting and ending counter values (numerical values = numbers) starting=1; % for example, this for-loop is starting from number "1". From Sutherland_wiki. x = x+1 This means "get the current value of x, add one, and then update x with the new value. OK, so you have a loop over rows - that should be obvious, right. Loops are implemented with the conditional branch, jump, and conditional set instructions. Often for loops can be eliminated using Matlab's vectorized addressing. For Loop Iteration (aka The Knight Rider) Often you want to iterate over a series of pins and do something to each one. 2 Branching Up: 6. Check the loop counter and. In general, when the loop begins, you know how many times it will repeat. To demonstrate, consider the following array, which holds the numbers 1 through 10:. This tool lets you change animated GIF loop flag. For-loops are typically used when the number of iterations is known before entering the loop. In MATLAB, it is really easy to do parallel processing of trivially parallelizable problems with a parfor loop. MATLAB will do its best, although the result may take some space if the variable is a large matrix. How this works is that the first pass of the outer loop triggers the inner loop, which executes to completion. I don't see what you're asking. The for loop allows us to repeat certain commands. for minimization of f(x)= 3x2-8x+2, user will enter '3*x^2-8*x+2'. MATLAB/Cookbook/for and while loops. Community Home;. An index into a list. " In this example the task is performed 10 times as X counts from 0 to 10. Programming a while loop structure in MATLAB includes three components: the condition/expression, the repeated code block, and a termination statement. Rules and guidelines for the for loop. As a list that accumulated values. CODE HERE. Note: The MATLAB nyquist command does not provide an adequate representation for systems that have open-loop poles on the imaginary axis. How to Create a Multiplication Table in MATLAB Using Nested Loops. Just be careful about your final category - it assigns the last value to whatever values are left over that didn't meet any condition (including if a value is NA!) so make sure you want that to happen. Example: (from a past MATLAB. Aug 29, 2018 · How to Create a Multiplication Table in MATLAB Using Nested Loops. I tried some vectorization but for nested loops things get really complicated, especially with different loop sizes. MATLAB is a high-level programming language that does not require managing memory details. For instance, this example blinks 6 LEDs attached to the Arduino or Genuino by using a for() loop to cycle back and forth through digital pins 2-7. count-controlled loops. Typically, the syntax is given by something of the form for i = 1:5. The integer is called a loop control variable. Jan 28, 2013 · This tutorial gives a complete overview as to how to write an Excel file from Matlab. Background on parfor-loops. Third step : After every execution of for loop’s body, the increment/decrement part of for loop executes that updates the loop counter. Matlab CAN parallelize a loop containing a reduction variable. Aug 20, 2019 · Saving Data In A For Loop Into An Array. Remember that in Matlab an n x 1 vector is different from a 1 x n vector, so even for vectors you should have Matlab provide you with both the number of rows and the number of columns. To accomplish this, we could loop through all 1, 2, and 3 digit integers, testing if each is a prime number (using the isprime function). How this works is that the first pass of the outer loop triggers the inner loop, which executes to completion. The question is worded as such: The counter in a for or while loop can be given explicit increment: for i =m:k:n to advance the counter i by k each time. 1 Updating variables A common pattern in assignment statements is an assignment statement that updates a variable - where the new value of the variable depends on the old. Example Code. MATLAB Commands – 1 MATLAB Commands and Functions Dr. Learn more about while loop, loop, taylor series MATLAB. Loops are implemented with the conditional branch, jump, and conditional set instructions. Functions showing input/output in MATLAB counter. Aug 02, 2016 · Is there an easy way to make a for loop count down instead of up? I know that I can do something like this: for i = 1:100 % do stuff end But I need the numbers in the opposite order. From Wikiversity < MATLAB‎ %x needs to have an established starting value for a 'loop counter' to see how %many times it. The only more efficient you could get would be for the case where you are certain that long_variable_name does not share contents with any other variable, in which case with some work it is possible to modify the variable "in-place". one counter is sufficient already. In this benchmark, we test a loop that sums the lengths of elements in a string list. My professor's Matlab lectures are sorely lacking and they only seem to confuse me even more on the usage of for loops. For Loop Iteration (aka The Knight Rider) Often you want to iterate over a series of pins and do something to each one. Remember that in Matlab an n x 1 vector is different from a 1 x n vector, so even for vectors you should have Matlab provide you with both the number of rows and the number of columns. How to count if loops. "Quadratic Interpolation" program in MATLAB for one-dimensional minimization. To programmatically exit the loop, use a break statement. MATLAB - The Nested Loops - MATLAB allows to use one loop inside another loop. If you have a loop that is meant to go through a pre-determined number of iterations, and you have set up a loop counter to count the iteration you are on:. Listed below are all of the tasks on Rosetta Code which have been solved using MATLAB. Cut and paste the above code into the Matlab editor. Asked by matlab on my older work machine when I make Matlab do extra work. Check the loop counter and. You can try changing the simulation settings so Simulink only calculates one iteration or just decimate the matrix in matlab. m Prompts user for a number, then echoes it. for loops are useful for repeating a process a certain number of times while a while loop is useful for repeating a process until a specified condition is met. That tutorial was linked to at the top of this thread, for everyone to read. For every time the while loop runs, the value of the counter is increased by 2. count-controlled loops. Real programming Previous: 6. If you want to repeat some action in a predetermined way, you can use the for loop. Following section shows few examples to illustrate the concept. Ripple specializes in high-channel count recording and stimulation systems for electrophysiology. for loop, especially nested for loops since these can make a Matlab programs run time orders of magnitude longer than may be needed. With loop control statements, you can repeatedly execute a block of code. As arrays are the basic data structure in MATLAB, it is important to understand how to use them effectively. There are two types of loops: for statements loop a specific number of times, and keep track of each iteration with an incrementing index variable. A for loop is mostly used to loop through a piece of a given number of time ( the length of an array or x number of time /5). There is also a "For Each" structure that is like the for loop, but has no counter. The for-loop uses fewer statements. May 06, 2013 · I want to learn how to input a bunch of numbers into a loop and use the counter to find how many "count numbers" I get for that input. Lets say I am on the for loop counter 4. Through experience you will find that the for loop is useful when the number of iterations that a condition is run is known, whereas a while loop is useful when the number of iterations is unknown. In most cases, one can replace nested loops with efficient matrix manipulation. Then the while loop will run if the variable counter is smaller then the variable "howmuch". In each iteration of the for-loop, the variable Counter will take one of the values of i. $\begingroup$ This is how Costas Loop is designed. As far as I know the matlab for-loop works similar to the for_each-loop that can be seen in many programming languages these days, or maybe the range-for in c++11. reset the counter in for loop. It then compares the current value of SayIt to Times. In the examples of for loops, what was the looping variable often used for? Storing the results of a calculation inside the loop. Further, for loops provide similar functionality to while loops, but a counter is provided in the body of the loop. Ripple specializes in high-channel count recording and stimulation systems for electrophysiology. As said before (after the for loop. Any value can be given in the range, in lines with the index notation Matlab provides. Contents[show] Explanation To explain how a for loop works here is an example using a while loop int i = 0 ; // initialising the count to 0 while ( i 10 ) { // "i 10" is the condition that allows the loop. For more information on those topics see one of our tutorials on vectors (Introduction to Vectors in Matlab), matrices (Introduction to Matrices in Matlab), vector operations (Vector Functions), or loops (Loops). WELCOME TO MAC. Real programming Previous: 6. However, when using a parfor-loop the iterations are run not on the client MATLAB machine but are run in parallel on MATLAB workers. The Grapevine Neural Interface System is a complete system with neural interface processor, trellis software, and digital front ends for stimulation control, single multi-unit activity, LFP, ECoG, EMG, EEG, analog, and digital signals. Loop until counter. continue applies only to the body of the loop where it is called. However, these structures look very similar in other computer languages, such as C, Java, Pascal, etc. Finding length between two array elements. Creating a While Loop. Jump to: Each time through the loop, the counter variable will Use Matlab to create a plot of the concentration as a. Such a loop is called a counting loop. Prerequisites The For Loops Primer assumes knowledge of the MATLAB IDE, MATLAB help, arithmetic operations, built in functions, scripts, variables, arrays, logic expressions, and conditional structures. In This Problem We Will Evaluate The Product Of The First 10 Odd Numbers 1 3 5. EXERCISES FOR AND WHILE LOOPS IN MATLAB For loops and while loops allow the computer to run through a series of commands, repeatedly. The MATLAB script runs a For Loop. The drawing shows the general form of a loop statement for most programming languages. 1 Loops MATLAB has two distinct looping constructs: for loops and while loops. Count occurrences of ones in islands across rows - MATLAB. Example Code. Gauss Seidel Iretative Method. You can use it to add or remove endless loop from animated GIF. It's great. From Sutherland_wiki. 2 Branching Up: 6. Matlab was designed for dealing with numbers, not strings. The while loop is a conditional loop in that it depends upon a logical condition. MATLAB Lesson 8 - Logic and Control. x = x+1 This means "get the current value of x, add one, and then update x with the new value. And: We find the for-loop syntax is more than two times faster that the while-loop syntax here. count = 0; % count variable, start. Below is what I've managed to code so far for this problem:. An index into a list. In this problem we will evaluate the product of the first 10 odd numbers 1·3·5··19 in two ways: (a) Write a script file that evaluates the product of the first 10 odd numbers using a for loop. count-controlled loops. If it evaluates to FALSE, the loop ends. The following example script creates a vector containing the areas of circles with radii 1 through 4 using a while loop. Your Assignment. As a list that accumulated values. In this tutorial we will assume that you know how to create vectors and matrices, know how to index into them, and know about loops. Following section shows few examples to illustrate the concept. What is the difference between while loop and for loop in matlab? A while loop executes code inside the while block continuously until the said condition is not true. Any value can be given in the range, in lines with the index notation Matlab provides. count is the number of iterations performed Saving and ruunning the program. Write a MATLAB program to calculate and plot Cp versus t for 24 hours in increments of 0. If the conditional expression evaluates to a matrix, MATLAB evaluates the statements only if all elements in the matrix are true (nonzero). k=k+1) to address the Cp array at each time increment (i. The for statement also has another form designed for iteration through Collections and arrays This form is sometimes referred to as the enhanced for statement, and can be used to make your loops more compact and easy to read. All of the loop structures in matlab are started with a keyword such as for, or while and they all end with the word end. To skip the rest of the instructions in the loop and begin the next iteration, use a continue statement. Rules and guidelines for the for loop. Oct 10, 2017 · How to count if loops. MATLAB - The for Loop - A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. Dec 16, 2014 · how to count number of iterations. Step 2 : In this step, we will check the version of Excel. ) The for loop runs once with the loop variable set to the column. Within my tutorial you will find many links to the MATLAB documentation, to MATLAB blogs, and to other threads on this forum: they all explain why this is a bad approach to writing code. Armstrong State University Engineering Studies. Physics 111 has Matlab with Statistics Toolbox package installed on all lab computers; see lab staff for remote access. In the case of a for loop, the commands are executed a fixed number of times, whereas in a while loop the commands are executed until some specified condition is met. projectiletrajectory. The integer is called a loop control variable. You can try changing the simulation settings so Simulink only calculates one iteration or just decimate the matrix in matlab. Use a for loop to calculate Cp for each time increment and add drug dosages at the appropriate times. A loop statement allows us to execute a statement or group of statements multiple times. Armed with this knowledge, you can compute all or some particular root. for minimization of f(x)= 3x2-8x+2, user will enter ‘3*x^2-8*x+2’. Question: Use The Matlab To Do The Questions The Counter In A For Or While Loop Can Be Given Explicit Increment: For I =m:k:n To Advance The Counter I By K Each Time. Build a vector in MATLAB using given discontinuous function f(t) (where f(t) is different for different intervals). In this line, counter is the variable that is getting incremented over the. Prepare Your Environment. If the input is ten, then 1 through 10 will be printed on the screen. However, I want MATLAB to use only (1 1), (2 2), (3 3) and so on. Matlab CAN parallelize a loop containing a reduction variable. Each row consists of zeroes and ones, I want to make a for loop to consider all ones adjacent to each row and name it by the number of each column. There are two types of loops used in MATLAB: "for loops" and "while loops. Dec 01, 2015 · While loop runs infinitely. There is another kind of loop in Python called a for loop. For-loops are typically used when the number of iterations is known before entering the loop. No, there is no "do while" loop in Python. Armstrong State University Engineering Studies. The drawing shows the general form of a loop statement for most programming languages. Once the condition returns false, the statements in for loop does not execute and the control gets transferred to the next statement in the program after for loop. In this line, counter is the variable that is getting incremented over the. For instance, this example blinks 6 LEDs attached to the Arduino or Genuino by using a for() loop to cycle back and forth through digital pins 2-7. What that means is, it creates the vector right at the beginning (so, if you say a = 1:3 it creates a = [1,2,3] right away, and then cycles through. 1 Loop Examples 1. I want to learn how to input a bunch of numbers into a loop and use the counter to find how many "count numbers" I get for that input. The example below displays the numbers from 0 to 10:. the loop body. You better not use FOR loop.