Pseudocode used in IMP-35 course

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Pseudocode used in IMP-35 course - Presentation Transcript

    1. Pseudocode used in TAMK IMP-35 course Jussi Pohjolainen Tampere University of Applied Sciences
    2. Basics
      • // Print to the screen "something"
      • print "something"
      • // Print to the screen "something" and enter
      • println "something"
      • // Ask user input and store it into variable
      • myvariable := readInput()
    3. if
      • print "Give number"
      • number1 := readInput()
      • print "Give number"
      • number2 := readInput()
      • // If number2 is NOT 0
      • if(number2 ≠ 0)
      • {
      • divide := number1 / number2
      • print "Result = " + divide
      • }
    4. if else
      • print "Give number"
      • number1 := readInput()
      • print "Give number"
      • number2 := readInput()
      • // If number2 is NOT 0
      • if(number2 ≠ 0)
      • {
      • divide := number1 / number2
      • print "Result = " + divide
      • }
      • else
      • {
      • print "You cannot divide with zero!"
      • }
    5. if else if
      • print "Give number";
      • number := readInput();
      • if(number = 0)
      • {
      • print "You gave zero.";
      • }
      • else if(number = 1)
      • {
      • print "You gave one.";
      • }
      • else if(number = 2)
      • {
      • print "You gave two.";
      • }
      • else
      • {
      • print "You did not give zero, one or two.";
      • }
    6. while
      • // Prints three times "Hello"
      • i := 0
      • while(i < 3)
      • {
      • println &quot;Hello&quot;
      • i := i + 1
      • }
    7. do while
      • // Prints three times &quot;Hello&quot;
      • i := 0
      • do
      • {
      • println &quot;Hello&quot;
      • i := i + 1
      • }
      • while(i < 3)
    8. if and while together
      • secretnumber := 8
      • do
      • {
      • print &quot;Give number&quot;
      • number := readInput()
      • if(secretnumber < number)
      • {
      • print &quot;Secret number is smaller.&quot;
      • }
      • else if(secretnumber > number)
      • {
      • print &quot;Secret number is larger&quot;
      • }
      • }
      • while(number != secretnumber)
      • print &quot;Correct&quot;
    SlideShare Zeitgeist 2009

    + Tampere University of Applied SciencesTampere University of Applied Sciences Nominate

    custom

    100 views, 0 favs, 1 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 100
      • 71 on SlideShare
      • 29 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 2
    Most viewed embeds
    • 29 views on http://imp-35.ning.com

    more

    All embeds
    • 29 views on http://imp-35.ning.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories