Program to counting in a while loop, MATLAB in Engineering

Program to Counting in a while loop:

The script initializes variable counter to 0. Then, in the while loop action, each and every time the user successfully enter a number, the program increments the counter variable. At the finish of the script, it prints the number of numbers which were entered.

 

>> countposnum

Enter a positive number: 4

You entered a 4.

Enter a positive number: 8

You entered a 8.

Enter a positive number: 11

You entered a 11.

Enter a positive number: -4

Thanks, you entered 3 positive numbers

 

Posted Date: 10/19/2012 6:11:05 AM | Location : United States







Related Discussions:- Program to counting in a while loop, Assignment Help, Ask Question on Program to counting in a while loop, Get Answer, Expert's Help, Program to counting in a while loop Discussions

Write discussion on Program to counting in a while loop
Your posts are moderated
Related Questions
Use of built-in colormaps: MATLAB has built-in colormaps, it is also possible to generate others by using combinations of any colors. For illustration, the following generates

Anonymous Functions: The anonymous function is a very easy, one-line function. The benefit of an anonymous function is that it does not have to be stored in an M-file. This ca

True color matrice: The true color matrices are the other way to represent images. The true color matrices are 3-dimensional matrices. The first two coordinates are the coordi

Gauss-Jordan: The Gauss-Jordan elimination technique begins in similar way which the Gauss elimination technique does, but then rather than of back-substitution, the eliminati

calcrectarea subfunction: function call: area = calcrectarea(len,wid); function header: function area = calcrectarea(len, wid)   In the function call, the two arg

Execute a exponential function program: Running the script will take up the menu as shown in the figure: Then, what happens will totally depend on which button(s) the

Indexing into Vectors of structures: Frequently, when the data structure is a vector of structures, it is essential to iterate through the vector in order by various fields. F

Reduced Row Echelon Form: The Gauss Jordan technique results in a diagonal form; for illustration, for a 3 × 3 system: The Reduced Row Echelon Forms take this one step

str2num function - String: The function str2num does the opposite; it takes the string in which a number is stored and converts it to the type double: >> num = str2num('123.

Function issorted - set operations: The function issorted will return 1 for logical true when the argument is sorted in ascending order (minimum to maximum), or 0 for false wh