We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10
Scratch Program TO Add Two Numbers:
Double Click on Scratch to open the App
Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create three variables and name them as “a”, “b” and “Result” Go to sensing, drag and drop “ask” and enter text as “Enter first number” Go to variables, drag and drop “set variable”, select “a”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to sensing, drag and drop “ask” and enter text as “Enter second number” Go to variables, drag and drop “set variable”, select “b”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to variables, drag and drop “set variable”, select “Result”. Go to “operators”, drag and drop “+” to RHS of “set variable” Go to variables, drag and drop variable “a” and “b” to LHS and RHS part of “set variable”, respectively. Go to “looks”, drag and drop “say”, enter text as “Sum of two numbers is: =” Click on green flag, execute and test the program.
Scratch Program TO Add check entered number is odd/even:
Double Click on Scratch to open the App
Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create variable and name it as “n”. Go to sensing, drag and drop “ask” and enter text as “Enter the number” Go to variables, drag and drop “set variable”, select “n”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to “controls”, drag and drop “if then else” Go to “operators” drag and drop “=” operator on “condition” part of “if then else” Go to “operators” drag and drop “mod” operator on LHS of “=” operator, and enter 0 at RHS of “=” operator. Set LHS of “mod” operator with “n” and RHS as 0 Go to “looks”, drag and drop “say” at then part of “if then else” block, enter text as “Entered Number is Even” Go to “looks”, drag and drop “say” at else part of “if then else” block, enter text as “Entered Number is Odd” Click on green flag, execute and test the program.
Scratch Program TO Find the Largest of two numbers:
Double Click on Scratch to open the App
Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create two variables and name them as “a” and “b”. Go to sensing, drag and drop “ask” and enter text as “Enter first number” Go to variables, drag and drop “set variable”, select “a”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to sensing, drag and drop “ask” and enter text as “Enter second number” Go to variables, drag and drop “set variable”, select “b”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to controls, drag and drop “if then else” Go to operators, drag and drop “>” operator on condition part of “if the else” Set LHS part of “>” operator as “a” and RHS part as “b” Go to “looks”, drag and drop “say” at “then” part of “if then else” block, and enter display text as “First number is larger”. Go to “looks”, drag and drop “say” at “else” part of “if then else” block, and enter display text as “Second number is larger”. Click on green flag, execute and test the program.
Scratch Program TO Find the Factorial of a number:
Double Click on Scratch to open the App
Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create variable and name it as “n”. Go to sensing, drag and drop “ask” and enter text as “Enter the number” Go to variables, drag and drop “set variable”, select “n”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to variables, click on “Make Variable” Create variable and name it as “fact”. Go to variables, drag and drop “set variable”, select “fact” and set value as “1” Go to controls, drag and drop “repeat until” block. Go to operators, drag and drop “=” operator on condition part of “repeat until” block. Set LHS of “=” operator as variable “n” and RHS as “0” Go to variables, drag and drop “set variable” inside body part the “repeat until” block. Select “fact” as variable, go to operators drag and drop “*” operator at RHS part of “set variable”. Now, set LHS of “*” operator with variable “fact” and RHS with variable “n”. Go to variables, drag and drop “set variable” inside body part the “repeat until” block. Select “n” as variable, go to operators drag and drop “-” operator at RHS part of “set variable”. Now, set LHS of “-” operator with variable “n” and RHS with variable “1”. Go to “looks”, drag and drop “say” and enter display text as “Factorial of entered number is: =”. Click on green flag, execute and test the program.
Scratch Program TO Find the Sum of Digits of a number:
Double Click on Scratch to open the App
Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create three variables and name them as “Num”, “Sum” and “Digit”. Go to sensing, drag and drop “ask” and enter text as “Enter the number” Go to variables, drag and drop “set variable”, select “Num”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to variables, drag and drop “set variable”, select “Sum” and set it to “0”. Go to controls, drag and drop “repeat until”. Go to operators, drag and drop “<” operator on condition part of “repeat until” block. Set LHS of “<” operator with variable “Num” and RHS as “0”. Go to variables, drag and drop “set variable”, select Digit, drag and drop “mod” operator on RHS of “set variable” block. Set LHS of “mod” operator with variable “Num” and RHS with “10” Go to variables, drag and drop “set variable”, select Sum, drag and drop “+” operator on RHS of “set variable” block. Set LHS of “+” operator with variable “Sum” and RHS with “Digit” Go to variables, drag and drop “set variable”, select Num, drag and drop “floor” operator on RHS of “set variable” block. Go to operators, drag and drop “/” operator on RHS of “floor” operator. Set LHS of “/” operator with variable “Num” and RHS with “10” Go to “looks”, drag and drop “say” and enter display text as “Sum of digits of entered number is: =”. Click on green flag, execute and test the program.
Scratch Program TO Find the Reverse of a number:
Double Click on Scratch to open the App
Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create three variables and name them as “Num”, “Rev” and “Digit”. Go to sensing, drag and drop “ask” and enter text as “Enter the number” Go to variables, drag and drop “set variable”, select “Num”. Go to sensing, drag and drop “answer” block to RHS of “set variable” Go to variables, drag and drop “set variable”, select “Rev” and set it to “0”. Go to controls, drag and drop “repeat until”. Go to operators, drag and drop “=” operator on condition part of “repeat until” block. Set LHS of “=” operator with variable “Num” and RHS as “0”. Go to variables, drag and drop “set variable”, select Digit, drag and drop “mod” operator on RHS of “set variable” block. Set LHS of “mod” operator with variable “Num” and RHS with “10” Go to variables, drag and drop “set variable”, select Rev, drag and drop “*” operator on RHS of “set variable” block. Set LHS of “*” operator with variable “Rev” and RHS with “10” Go to variables, drag and drop “set variable”, select Rev, drag and drop “+” operator on RHS of “set variable” block. Set LHS of “+” operator with variable “Rev” and RHS with variable “Digit” Go to variables, drag and drop “set variable”, select Num, drag and drop “floor” operator on RHS of “set variable” block. Go to operators, drag and drop “/” operator on RHS of “floor” operator. Set LHS of “/” operator with variable “Num” and RHS with “10” Go to “looks”, drag and drop “say” and enter display text as “Reverse of entered number is: =”. Click on green flag, execute and test the program.
Scratch Program for Jumpping Chick:
Steps for chick sprite:
Double Click on Scratch to open the App
Change backdrop (backgroud, whichever tou want0 Delete the default Sprite (Cat-Sprite) Add Chick sprite and code as shown below. o Drag and drop “when clicked” block o Drag and drop go to X: Y: block, and set X: -200, Y: -129 (Initial position of chick) o Go to variables, make new variable “score” to maintain score o Drag and drop set block, and set score as 0, the initial value of score. Drag and drop “when key pressed” block Drag and drop “start sound” block, to indicate user has pressed space key. Drag and drop “repeat 10” block, then drag and drop “change y by 15” in this repeat block. This is for whenever user press space key chick has to jump up to escape from the obstacle(egg). As per previous step chick has jumped up to escape from the obstacle(egg), next chick has to come back to ground, for that drag and drop “repeat 10” block, then drag and drop “change y by -15” in this repeat block. This is for whenever user press space key,
Steps for egg sprite:
Add egg sprite and code as follows o Drag and drop “when clicked” block o Drag and drop “wait until” block. o Go to sensing controls, drag and drop “touching chick?” block to conditional part of the “wait until”block. This is for stopping the game whenever chick touches the egg. o Drag and drop “stop all” block to stop the game.
Steps for egg sprite glide (Move):
Drag and drop “when clicked” block
Drag and drop “forever” block; this is for egg has to move from right to left continuously. Within that “forever” bloc, drag and drop “go to X: Y:” block, and set X and Y values to initial position of the egg. Drag and drop “glide” block, set speed as 3-Seconds, and destination/end point with X and Y values.
Scratch Program for Apple-Bowl Game:
Steps for Apple sprite:
Double Click on Scratch to open the App
Change backdrop (backgroud, whichever you want) Delete the default Sprite (Cat-Sprite) Add Apple sprite and code as shown below. o To position Apple at vertically top and horizontally random. Drag and drop “when clicked” block Drag and drop “go to random position” Drag and drop “set y to”, and set y value to “180” Go to variables, make new variable “score” to maintain score Drag and drop set block, and set score as 0, the initial value of score. o To make Apple to fall continuously from top to bottom Drag and drop “forever” block Drag and drop “change y by” block, set y value to -5 Drag and drop “if then”, drag and drop “<” operator on condition part of “if then” block. Drag and drop, “y position” at LHS part of “<” operator, set RHS with value “170” Drag and drop “go to random position” and “set y to” in body part of “if then” block. And set y value to “180”. o To count score when Apple falls in Bowl Drag and drop “when clicked” block Go to variables, click on “Make Variable” Create variable and name it as “Score”. Go to variables, drag and drop “set variable”, select “Score” and set initial value as “0”. Go to controls, drag and drop “forever” block. Drag and drop “if the else” block inside the “forever” block. Go to sensing, drag and drop “touching” block, select “bowl” Go to variables, drag and drop “change by” block to body part of the “if then else” block. Set “LHS” of “change by” block with “Score” and RHS as “1” Drag and drop “go to random position” and “set y to” in body part of “if then else” block. And set y value to “180”.
Steps for Bowl sprite:
Add Bowl sprite and code as shown below.
o Drag and drop “when clicked” block o Go to controls, drag and drop “forever” block. o Drag and drop “if then else” block to body part of the “forever” block. o Go to sensing, drag and drop “key pressed” block on to condition part of “if then else” block, and select “right key”. o Go to motions, drag and drop “change x by” block to then part of “if then else” block, and set value to “10”. (For moving bowl right) o Drag and drop “if then else” block to else part of the previous “if then else” block. o Go to sensing, drag and drop “key pressed” block on to condition part of second “if then else” block, and select “left key”. o Go to motions, drag and drop “change x by” block to then part of second “if then else” block, and set value to “-10”. (For moving bowl left)