Answered by:
Small Basic

Question
-
Hey i'm having trouble with a certain part of the Small Basic Curriculum, i cant figure out how to write a program that calculates the area and circumference of a circle based on its diameter. Can anyone help me understand what to do?
Thanks, ScikoticRage
- Moved by Mr. Wharty Thursday, May 16, 2013 3:34 AM
Wednesday, May 15, 2013 11:15 PM
Answers
-
Ok, i will explain this as best i can.
Ask the user for the diameter of the circle. then, to find the circumference, use this:
You could go:
circum = 3.14 * diameter (or what ever you name the variables)
Then,Find the area:
area = 3.14 * (diameter / 2)
(note, i used parentheses to that it wouldn't go like 3.14 * diameter then that answer divided by 2.
code:
TextWindow.WriteLine("Enter in the diameter of a circle: ") diameter = TextWindow.Read() circum = 3.14 * diameter area = 3.14 * (diameter / 2) TextWindow.WriteLine("The area is: " + area) TextWindow.WriteLine("The circumference is: " + circum)
Help? If it doesn't, i'll gladly re-make this and explain it. :3
I am a 12 year old learning how to code using small basic.
- Edited by 8Bit Pony Thursday, May 16, 2013 4:58 PM
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 4:09 AM -
For the area you should square the diameter/2 as:
diameter*diameter/4
Jan [ WhTurner ] The Netherlands
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 8:06 AMAnswerer -
For the area you do: A = ((d / 2) * (d / 2)) * 3.14
"D" would be the diameter
Its not "area = 3.14 * (diameter / 2)" Its radius squared times pi.
See here: http://www.mathgoodies.com/lessons/vol2/circle_area.html
It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 6:18 PMAnswerer -
So like this:
TextWindow.Write("Enter the diameter: ") Dia = TextWindow.Read() Area = ((Dia / 2) * (Dia / 2)) * 3.14 TextWindow.WriteLine("The area is " + Area)
It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 9:44 PMAnswerer
All replies
-
Ok, i will explain this as best i can.
Ask the user for the diameter of the circle. then, to find the circumference, use this:
You could go:
circum = 3.14 * diameter (or what ever you name the variables)
Then,Find the area:
area = 3.14 * (diameter / 2)
(note, i used parentheses to that it wouldn't go like 3.14 * diameter then that answer divided by 2.
code:
TextWindow.WriteLine("Enter in the diameter of a circle: ") diameter = TextWindow.Read() circum = 3.14 * diameter area = 3.14 * (diameter / 2) TextWindow.WriteLine("The area is: " + area) TextWindow.WriteLine("The circumference is: " + circum)
Help? If it doesn't, i'll gladly re-make this and explain it. :3
I am a 12 year old learning how to code using small basic.
- Edited by 8Bit Pony Thursday, May 16, 2013 4:58 PM
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 4:09 AM -
For the area you should square the diameter/2 as:
diameter*diameter/4
Jan [ WhTurner ] The Netherlands
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 8:06 AMAnswerer -
For the area you do: A = ((d / 2) * (d / 2)) * 3.14
"D" would be the diameter
Its not "area = 3.14 * (diameter / 2)" Its radius squared times pi.
See here: http://www.mathgoodies.com/lessons/vol2/circle_area.html
It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 6:18 PMAnswerer -
oh thanks. i don't really like finding the area's and circumferences...i kinda forgot how to, so yes, thanks!
I am a 12 year old learning how to code using small basic.
Thursday, May 16, 2013 6:21 PM -
So like this:
TextWindow.Write("Enter the diameter: ") Dia = TextWindow.Read() Area = ((Dia / 2) * (Dia / 2)) * 3.14 TextWindow.WriteLine("The area is " + Area)
It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11
- Proposed as answer by Ed Price - MSFTMicrosoft employee Saturday, May 18, 2013 10:53 PM
- Marked as answer by Nonki Takahashi Sunday, May 26, 2013 12:49 AM
Thursday, May 16, 2013 9:44 PMAnswerer -
This is my conclusion.
Sample of Small Basic Curriculum "The Pi Property" isTextWindow.Write("Enter the radius of the circle:") Radius = TextWindow.Read() Area = Math.Pi * Math.Power(Radius, 2) TextWindow.WriteLine("Area of the Circle is " + Area)
So base on diameter:
TextWindow.Write("Enter the diameter of the circle:") Diameter = TextWindow.Read() Radius = Diameter / 2 Area = Math.Pi * Math.Power(Radius, 2) TextWindow.WriteLine("Area of the Circle is " + Area) Circum = 2 * Math.Pi * Radius TextWindow.WriteLine("Circumference of the Circle is " + Circum)
Nonki Takahashi
Friday, May 17, 2013 10:34 AM -
This is my conclusion.
Sample of Small Basic Curriculum "The Pi Property" isTextWindow.Write("Enter the radius of the circle:") Radius = TextWindow.Read() Area = Math.Pi * Math.Power(Radius, 2) TextWindow.WriteLine("Area of the Circle is " + Area)
So base on diameter:
TextWindow.Write("Enter the diameter of the circle:") Diameter = TextWindow.Read() Radius = Diameter / 2 Area = Math.Pi * Math.Power(Radius, 2) TextWindow.WriteLine("Area of the Circle is " + Area) Circum = 2 * Math.Pi * Radius TextWindow.WriteLine("Circumference of the Circle is " + Circum)
Nonki Takahashi
Should we make a change to the curriculum to make it easier to understand?
Thanks!
Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)
Answer an interesting question? Create a wiki article about it!Saturday, May 18, 2013 10:54 PM