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
Illustration of Set operations: For illustration, given the vectors as shown below: >> v1 = 2:6 v1 = 2  3  4  5  6 >> v2 = 1:2:7 v2 = 1  3  5  7

num2str function: The num2str function, that converts real numbers, can be called in many ways. If only the real number is passed to the num2str function, it will generate a s


Evaluating a string: The function eval is used to compute a string as a function. For illustration, below is the string 'plot(x)'is interpreted to be a call to plot the functi

Print from the structure: To print from the structure, a disp function will show either the whole structure or a field. >> disp(package) item_no: 123 cost: 19.99

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, th

Matrix Multiplication: The Matrix multiplication does not mean multiplying term by term; and it is not an array operation. The Matrix multiplication has a very particular mean

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

Interchange rows : for illustration interchanging rows ri and rj is written as

Technique to create Nested structures: This technique is the most proficient. Though, the other technique is to build the nested structure one field at a time. As this is a ne