## Discuss Scratch

- Discussion Forums
- » Show and Tell
- » I made a (very basic) calculator!

- FuturePr0
- Scratcher

100+ posts

### I made a (very basic) calculator!

I've just shared a new project which is a calculator, it can do division, multiplication, adding, subtracting and square root problems! there are loads of lists and cloud variables for if you want statistics, if there is anything you think I can improve, tell me! You can see the project here.

*Last edited by FuturePr0 (March 12, 2018 06:54:20)*

I have reached 100 posts! my 100th post was posted at 12:30:46 PM on the ‘things i’m making and creating' section, You can find the topic here. I am VERY good and skilful at so many things. Also you should see this!

My FAVOURITE colour is Orange

- violet_raven
- Scratcher

100+ posts

### I made a (very basic) calculator!

I love how it's basic yet it works so well! I'm also working on a math project but I'm thinking about not doing it anymore because it's not really my style. Any tips?

stop [whatever you're doing and go click the links below!]Scratch the Seeker - great game that's challenging and fun

Gobo the Seeker - the long-awaited sequel to Scratch the Seeker

Pouncing Pies - a game where you gotta be cautious

Pixel Pastries - a game that gives you a passion for donuts

Pixel Pollinators - a game about bees

- FuturePr0
- Scratcher

100+ posts

### I made a (very basic) calculator!

if you want to do my method, then you would do this, but if you don't understand then just put all the scripts in your backpack and move them to your project, please credit me because i was ill when i made this: I love how it's basic yet it works so well! I'm also working on a math project but I'm thinking about not doing it anymore because it's not really my style. Any tips?

First of all, you need three variables:

(first number)WARNING: do not use the blue variable from sensing, make your own one from the data section. so it would be orange instead of blue.

(second number)

(answer :: variables) //this is a variable you made, not blue from sensing.

so how this will work is you would have one sprite, that sprite will ask you a question. the sprites first question would be asking you if you want to do division, multiplication, adding, or subtracting.

ask [Do you want to do multiplication, division, adding or subtracting?] and waitnow the next step requires a lot of code, so i'm going to word it. if you still don't understand you can take the script to your backpack with a comment attached to it saying ‘for violet_raven’. And use it for your project, but i would like credit. Because i was VERY ill when i made this project. so you need to program it so that if your answer is ‘division’ it will broadcast ‘division’ if it's multiplication, it would broadcast ‘multiplication’ etc.

if <(answer)= [multiplication]> then //this time you DO want a blue answer block, only for the maths question selection.now you want to make it so on the receiving end it does something, it will ask you what you want the first number to be and what to multiply by, divide add or subtract. A little like this:

broadcast [multiplication v]

end

when I receive [multiplication v]and then this will be the script for the answers:

ask [What do you want the first number to be?] and wait

set [first number v] to (answer) // for this you DO want the blue variable.

ask [what do you want to multiply by?] and wait

set [second number v] to (answer) //still using the blue variable. next step will use the variable you made that's orange.

set [answer v] to ((first number) * (second number)) //the little star means multiply in programming. because there is no 'times' key.(continued) on a normal keyboard. This is useful for if you want to mutliply. but if you want to divide, this would be the script.

set [answer v] to ((first number) / (second number)) //the slash means divide in programming, because there is no 'divide' key.(continued) on a normal keyboard. For adding it would be this:

set [answer v] to ((first number) + (second number)) //there is a plus on a normal keyboard so we just use an adding block.then you could program the cat to say the answer.

set [answer v] to ((first number) - (second number)) //There is a minus key on the keyboard, just use the dash key.

say(join (join (join (join (first number) [add] ) (second number)) [equals] ) (answer :: variables)) //keep in mind your using the orange variable saying 'answer'. nowAnd NEVER give up! have fun!

*Last edited by FuturePr0 (Feb. 11, 2018 16:13:34)*

I have reached 100 posts! my 100th post was posted at 12:30:46 PM on the ‘things i’m making and creating' section, You can find the topic here. I am VERY good and skilful at so many things. Also you should see this!

My FAVOURITE colour is Orange

- TheAwesome98
- Scratcher

18 posts

### I made a (very basic) calculator!

if you want to do my method, then you would do this, but if you don't understand then just put all the scripts in your backpack and move them to your project, please credit me because i was ill when i made this: I love how it's basic yet it works so well! I'm also working on a math project but I'm thinking about not doing it anymore because it's not really my style. Any tips?

First of all, you need three variables:(first number)WARNING: do not use the blue variable from sensing, make your own one from the data section. so it would be orange instead of blue.

(second number)

(answer) // this is meant to be orange, not the default blue from sensing.

so how this will work is you would have one sprite, that sprite will ask you a question. the sprites first question would be asking you if you want to do division, multiplication, adding, or subtracting.ask [Do you want to do multiplication, division, adding or subtracting?] and waitnow the next step requires a lot of code, so i'm going to word it. if you still don't understand you can take the script to your backpack with a comment attached to it saying ‘for violet_raven’. And use it for your project, but i would like credit. Because i was VERY ill when i made this project. so you need to program it so that if your answer is ‘division’ it will broadcast ‘division’ if it's multiplication, it would broadcast ‘multiplication’ etc.if <(answer)= [multiplication]> then //this time you DO want a blue answer block, only for the maths question selection.now you want to make it so on the receiving end it does something, it will ask you what you want the first number to be and what to multiply by, divide add or subtract. A little like this:

broadcast [multiplication v]

endwhen I receive [multiplication v]and then this will be the script for the answers:

ask [What do you want the first number to be?] and wait

set [first number v] to (answer) // for this you DO want the blue variable.

ask [what do you want to multiply by?] and wait

set [second number v] to (answer) //still using the blue variable. next step will use the variable you made that's orange.set [answer v] to ((first number) * (second number)) //the little star means multiply in programming. because there is no 'times' key.(continued) on a normal keyboard. This is useful for if you want to mutliply. but if you want to divide, this would be the script.set [answer v] to ((first number) / (second number)) //the slash means divide in programming, because there is no 'divide' key.(continued) on a normal keyboard. For adding it would be this:set [answer v] to ((first number) + (second number)) //there is a plus on a normal keyboard so we just use an adding block.then you could program the cat to say the answer.

set [answer v] to ((first number) - (second number)) //There is a minus key on the keyboard, just use the dash key.say(join (join (join (join (first number) [add] ) (second number)) [equals] ) (answer)) //keep in mind your still using the orange variable saying 'answer'.And NEVER give up! have fun!

(first number)

(second number)

(answer :: variables)

When I Think :: events

I like green :: operators

I mean Dark green :: sound

PEN!! :: pen

I hate troll OSes

Yeet! :: motion

I like Ugandan knuckles

forever if <I'm gay :: sound> :: control

Imagine :: events

Program :: pen

Share :: sound

end

- FuturePr0
- Scratcher

100+ posts

### I made a (very basic) calculator!

Yes, those are the three variables you need (Thanks! ), and If you want square root, just useif you want to do my method, then you would do this, but if you don't understand then just put all the scripts in your backpack and move them to your project, please credit me because i was ill when i made this: I love how it's basic yet it works so well! I'm also working on a math project but I'm thinking about not doing it anymore because it's not really my style. Any tips?

First of all, you need three variables:(first number)WARNING: do not use the blue variable from sensing, make your own one from the data section. so it would be orange instead of blue.

(second number)

(answer) // this is meant to be orange, not the default blue from sensing.

so how this will work is you would have one sprite, that sprite will ask you a question. the sprites first question would be asking you if you want to do division, multiplication, adding, or subtracting.ask [Do you want to do multiplication, division, adding or subtracting?] and waitnow the next step requires a lot of code, so i'm going to word it. if you still don't understand you can take the script to your backpack with a comment attached to it saying ‘for violet_raven’. And use it for your project, but i would like credit. Because i was VERY ill when i made this project. so you need to program it so that if your answer is ‘division’ it will broadcast ‘division’ if it's multiplication, it would broadcast ‘multiplication’ etc.if <(answer)= [multiplication]> then //this time you DO want a blue answer block, only for the maths question selection.now you want to make it so on the receiving end it does something, it will ask you what you want the first number to be and what to multiply by, divide add or subtract. A little like this:

broadcast [multiplication v]

endwhen I receive [multiplication v]and then this will be the script for the answers:

ask [What do you want the first number to be?] and wait

set [first number v] to (answer) // for this you DO want the blue variable.

ask [what do you want to multiply by?] and wait

set [second number v] to (answer) //still using the blue variable. next step will use the variable you made that's orange.set [answer v] to ((first number) * (second number)) //the little star means multiply in programming. because there is no 'times' key.(continued) on a normal keyboard. This is useful for if you want to mutliply. but if you want to divide, this would be the script.set [answer v] to ((first number) / (second number)) //the slash means divide in programming, because there is no 'divide' key.(continued) on a normal keyboard. For adding it would be this:set [answer v] to ((first number) + (second number)) //there is a plus on a normal keyboard so we just use an adding block.then you could program the cat to say the answer.

set [answer v] to ((first number) - (second number)) //There is a minus key on the keyboard, just use the dash key.say(join (join (join (join (first number) [add] ) (second number)) [equals] ) (answer)) //keep in mind your still using the orange variable saying 'answer'.And NEVER give up! have fun!(first number)

(second number)

(answer :: variables)

([sqrt v] of (first number)

I have reached 100 posts! my 100th post was posted at 12:30:46 PM on the ‘things i’m making and creating' section, You can find the topic here. I am VERY good and skilful at so many things. Also you should see this!

My FAVOURITE colour is Orange

- TheAwesome98
- Scratcher

18 posts

### I made a (very basic) calculator!

You do block :: name of type for example variablesYes, those are the three variables you need (Thanks! ), and If you want square root, just use

First of all, you need three variables:(first number)WARNING: do not use the blue variable from sensing, make your own one from the data section. so it would be orange instead of blue.

(second number)

(answer) // this is meant to be orange, not the default blue from sensing.

so how this will work is you would have one sprite, that sprite will ask you a question. the sprites first question would be asking you if you want to do division, multiplication, adding, or subtracting.ask [Do you want to do multiplication, division, adding or subtracting?] and waitnow the next step requires a lot of code, so i'm going to word it. if you still don't understand you can take the script to your backpack with a comment attached to it saying ‘for violet_raven’. And use it for your project, but i would like credit. Because i was VERY ill when i made this project. so you need to program it so that if your answer is ‘division’ it will broadcast ‘division’ if it's multiplication, it would broadcast ‘multiplication’ etc.

broadcast [multiplication v]

end

ask [What do you want the first number to be?] and wait

set [first number v] to (answer) // for this you DO want the blue variable.

ask [what do you want to multiply by?] and wait

set [second number v] to (answer) //still using the blue variable. next step will use the variable you made that's orange.

set [answer v] to ((first number) - (second number)) //There is a minus key on the keyboard, just use the dash key.say(join (join (join (join (first number) [add] ) (second number)) [equals] ) (answer)) //keep in mind your still using the orange variable saying 'answer'.And NEVER give up! have fun!(first number)

(second number)

(answer :: variables)([sqrt v] of (first number)

*Last edited by TheAwesome98 (Feb. 11, 2018 16:18:14)*

I like green :: operators

I mean Dark green :: sound

PEN!! :: pen

I hate troll OSes

Yeet! :: motion

I like Ugandan knuckles

forever if <I'm gay :: sound> :: control

Imagine :: events

Program :: pen

Share :: sound

end

- FuturePr0
- Scratcher

100+ posts

### I made a (very basic) calculator!

I know. Thanks!You do block :: name of type for example variablesYes, those are the three variables you need (Thanks! ), and If you want square root, just use

First of all, you need three variables:

(second number)

(answer) // this is meant to be orange, not the default blue from sensing.

so how this will work is you would have one sprite, that sprite will ask you a question. the sprites first question would be asking you if you want to do division, multiplication, adding, or subtracting.ask [Do you want to do multiplication, division, adding or subtracting?] and waitnow the next step requires a lot of code, so i'm going to word it. if you still don't understand you can take the script to your backpack with a comment attached to it saying ‘for violet_raven’. And use it for your project, but i would like credit. Because i was VERY ill when i made this project. so you need to program it so that if your answer is ‘division’ it will broadcast ‘division’ if it's multiplication, it would broadcast ‘multiplication’ etc.

broadcast [multiplication v]

end

ask [What do you want the first number to be?] and wait

set [first number v] to (answer) // for this you DO want the blue variable.

ask [what do you want to multiply by?] and wait

set [second number v] to (answer) //still using the blue variable. next step will use the variable you made that's orange.

set [answer v] to ((first number) - (second number)) //There is a minus key on the keyboard, just use the dash key.(first number)

(second number)

(answer :: variables)([sqrt v] of (first number)

I have reached 100 posts! my 100th post was posted at 12:30:46 PM on the ‘things i’m making and creating' section, You can find the topic here. I am VERY good and skilful at so many things. Also you should see this!

My FAVOURITE colour is Orange

- TheAwesome98
- Scratcher

18 posts

### I made a (very basic) calculator!

Ah.I know. Thanks!You do block :: name of type for example variables

First of all, you need three variables:

(second number)

(answer) // this is meant to be orange, not the default blue from sensing.

so how this will work is you would have one sprite, that sprite will ask you a question. the sprites first question would be asking you if you want to do division, multiplication, adding, or subtracting.ask [Do you want to do multiplication, division, adding or subtracting?] and waitnow the next step requires a lot of code, so i'm going to word it. if you still don't understand you can take the script to your backpack with a comment attached to it saying ‘for violet_raven’. And use it for your project, but i would like credit. Because i was VERY ill when i made this project. so you need to program it so that if your answer is ‘division’ it will broadcast ‘division’ if it's multiplication, it would broadcast ‘multiplication’ etc.

broadcast [multiplication v]

end

ask [What do you want the first number to be?] and wait

set [first number v] to (answer) // for this you DO want the blue variable.

ask [what do you want to multiply by?] and wait

set [second number v] to (answer) //still using the blue variable. next step will use the variable you made that's orange.

set [answer v] to ((first number) - (second number)) //There is a minus key on the keyboard, just use the dash key.(first number)

(second number)

(answer :: variables)([sqrt v] of (first number)

I like green :: operators

I mean Dark green :: sound

PEN!! :: pen

I hate troll OSes

Yeet! :: motion

I like Ugandan knuckles

forever if <I'm gay :: sound> :: control

Imagine :: events

Program :: pen

Share :: sound

end

- violet_raven
- Scratcher

100+ posts

### I made a (very basic) calculator!

wow lol you know you don't need to quote every time you comment? XD

stop [whatever you're doing and go click the links below!]Scratch the Seeker - great game that's challenging and fun

Gobo the Seeker - the long-awaited sequel to Scratch the Seeker

Pouncing Pies - a game where you gotta be cautious

Pixel Pastries - a game that gives you a passion for donuts

Pixel Pollinators - a game about bees

- FuturePr0
- Scratcher

100+ posts

### I made a (very basic) calculator!

I only do it when I'm replying to something. wow lol you know you don't need to quote every time you comment? XD

I have reached 100 posts! my 100th post was posted at 12:30:46 PM on the ‘things i’m making and creating' section, You can find the topic here. I am VERY good and skilful at so many things. Also you should see this!

My FAVOURITE colour is Orange

- Scoopy55555
- New to Scratch

5 posts

### I made a (very basic) calculator!

What I was meant to say was that everyone's message is a good way and I would of done the same!

- Discussion Forums
- » Show and Tell
- » I made a (very basic) calculator!