Posted by : Unknown Tuesday, October 8, 2013


Loops:
·        While Loops
While statements repeatedly execute a piece of code while given condition is true. The syntax of while statement is:

while condition
do something
end

·        For Loops
For statements repetitively execute piece of code given number of times. The syntax of for statement is:

for counter = start:step:stop
do something
end

Example:

Implement the factorial using functions and loop

Creating M-File In MATLAB

functions fact= factorial(num)
for i=num : -1 : 1
fact= fact*i
end;
end


I hope this is helpful for you...

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Let's Join Us

This blog is for Computer Programming Learner or who is interested in to learn different programming languages

Get Toolbar Free

Get our toolbar!

FeedBurner FeedCount

Computer Problems

Total Pageviews

Popular Post

Labels

About Us

I am a student Of computer Engineering , Studying at UET Taxila. Web development and Programming is my passion. http://about.me/umair.tariq

Top Commentators

Followers

Powered by Blogger.

Recent comments

- Copyright © Computer Problems -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -