You are on page 1of 2

Exp-2 Simple Programming Structure and Timing

Issus
Aim:-
o For Loop and While Loop
o Case structure and Sequential Structure
o Formula node and (Math Script (or) Matlab Script)
o State Machine Architecture
1. For Loop and While Loop programming
(a)For loop programming
. Write a !rogram "or #bonacci series using For loop upto 1$ %alues.
&int'
( )se nitiali*e Arra+ along ,ith shi"t register enable
( -o numeric indicator.. use onl+ /uild Arra+ "unction and Append the %alues.
. Write a program "or Factorial using For loop
. Write a program to dra, 01 arra+ using cascaded For loop.
(b)While Loop programming
. Write a program "or increment operation using While loop
&int'
)se iteration %alue "or increment i22
)se tan3 as indicator once set point reached stop the program.
. Write a program to add all the numbers entered b+ a user until user enters $
0. Case structure and Sequential Structure
(a)Case structure programming
. Write a program that as3s user an arithmetic operator (42454.45464 or 474) and t,o
operands and per"orm the corresponding calculation on the operands.
. 8uess a number bet,een 1 and 1$$ in +our mind. Write a program so that the
computer ,ill as3 +ou a series o" questions and determine that number based
on +our ans,ers.
&int'
9epeat the "ollo,ing steps as man+ times as needed'
Computer as3s5 :s it --;<
)ser responds ,ith =5 >5 or ?
)se t,o button dialog icon "or continuing the program until #nding the
result.
(b)Sequential Structure programming
. Compute the ,eighted score based on indi%idual assignments@ scores.
Let us sa+ there are onl+ A assignments B 0 eCams5 each ,ith maC
score o" 1$$. 9especti%e ,eights are (1$D5 1$D5 1$D5 AED and AED)
A. Formula node and (Math Script (or) Matlab Script)
programming
. mplement the "ollo,ing mathematical "unction
Exp-2 Simple Programming Structure and Timing
Issus
Where a>1$$5 b>1.E and c>$.E ,ith f and x %ariables to be de#nes b+ the user
such that the+ can be changed interacti%el+. Fhe time t is to be used to e%aluate
the output o" the "unction "or duration o" 1E periods or until the user presses the
stop button.

-ote that all the implementations should gi%e the same result.
Comment on the speed o" each method.
1ispla+ the results to sho, all 1E periods ,hen x is constant
1ispla+ the results to sho, all 1E periods ,hen x is changed (manuall+ or
!rogrammaticall+) bet,een $ and 0$ ,hilst the time increases "rom $ to 0$
seconds.

G. State Machine Architecture
. )sing the state machine architecture5 de%elop a simple arithmetic calculator


(Fhe calculator ta3es t,o numbers as inputs5 and based on ,hat the user selects5
adds5 subtracts5 multiplies or di%ides the t,o numbers and displa+s the result on the
"ront panel.

(Additionall+5 it chec3s be"ore di%ision i" there is a ,arning because o" di%ision b+
*ero. " this is true5 a /oolean LH1 called :Warning< lights up.

(Fhe user can quit the I b+ pressing a :Stop< button

You might also like