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
Sorting Vectors of structures: Whenever working with vector of structures, it is very common to sort based on a particular field within the structures. For illustration, recal

Implementation of binary search: The binary search can be implemented as a recursive function. The recursive function below also implements this binary search algorithm. It re

Converting between the String and Number types: The MATLAB has many functions which convert numbers to strings in which each character element is a separate digit, and vice ve

Program of passing arguments to functions: This was an illustration of a function which did not receive any input arguments nor did it return any output arguments; it easily a

Algorithm for the function e: The algorithm for the function eoption is as shown: Use the menu function to show the 4 choices. Error-check (an error would take place

Basic mathematical operations: All the basic mathematical operations can be executed on symbolic expressions and variables (example, add, raise to a power, multiply, subtract,

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

Example of Menu driven modular program: As an illustration of such a menu-driven program, we will write a program to discover the constant e. The constant e, known as the n

Forward substitution: The Forward substitution (done methodically by first getting a 0 in the a 21 place, and then a 31 , and lastly a 32 ): For the Gauss technique,

Appending variables to the Mat-File: Appending to the file adds to what has been saved in a file, and is accomplished by using the -append option. For illustration, supposing