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
Scaling:   change a row by multiplying it by a non-zero scalar sri →  ri For illustration, for the matrix:

Expanding a function: The expand function will multiply out terms, and factor will do the opposite: >> expand((x+2)*(x-1)) ans = x^2 x-2 >> factor(ans)

Illustration of Matrix solutions: For illustration, consider the three equations below with 3unknowns x 1 ,x 2 , and x 3 : We can write this in the form Ax = b here A

Gauss, Gauss-Jordan elimination: For 2 × 2 systems of equations, there are well-defined, easy solution techniques. Though, for the larger systems of equations, finding solutio

Uses of Function handles: The Function handles can also be generated for functions other than anonymous functions, both built-in & user-defined functions. For illustration, th

Patch function - graphics objects: The patch function is used to generate a patch graphics object, which is made from 2-dimensional polygons. The patch is defined by its verti

Splits a string : The strtok function splits a string into pieces; it can be called in many ways. The function receives one string as an input argument. It appears for the fir

Illustration of symbolic variable: When, on the other hand, z is a symbolic variable to start with, quotes are not required around the expression, and the words are automatica

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

Creating the structure Variables: Creating a structure variable can be accomplished by simply storing the values in fields by using assignment statements, or by using the stru