Languages :: Pascal :: Programming Languages |
|||
| By: collegeBoy |
Date: 19/01/2003 00:00:00 |
Points: 50 | Status: Answered Quality : Excellent |
|
how do we create a Pascal Program for the Area of the Circle |
|||
| By: monange | Date: 19/01/2003 11:08:00 | Type : Answer |
|
| Sounds a lot like homework. What is the formula for the area of a circle Try something like this Create a new program Ask the user for the radius or the diameter Calculate the area of the circle Display the area of the circle End the program mlmcc |
|||
| By: TheFalklands | Date: 21/01/2003 20:39:00 | Type : Comment |
|
| try this one if it helps: area:=3.14159*radius*radius; does it solves the problem? |
|||
| By: VGR | Date: 24/01/2003 09:38:00 | Type : Assist |
|
| sure it'll solve it. (even if you limited the number of decimals of Pi :D :D ) Why don't people just read the compiler's manual (or the language's manuel, like the "Pascal Report" of Wirth), or "Data+Algorithm=Program", and think two minutes and a half of the way they compute "manually" (mentally) the area of the circle, then implement it simply and concisely ? I'll never understand this. Always asking someone else first, in stead of working, I'll never understand. demo for saxcool : 1) the area of the circle if equal to Pi*square of the radius, usually (as of 1881 :D even for Americans :D :D ) in meters for the radius. 2) so we need to have the radius value, input by the user, and print out (output) the value of the computation of the area of the circle having that radius. 3) cool. Take a break. You worked hard. Now you have your algorithm and your interface (input/output) 4) now program and run it ! Program CircleArea(Input,Output); Const monPi : Extended = 3.141592653589793238462 ; Var radius, area : Extended; Begin WriteLn('Welcome in The Area Calculator of Saxcool'); Write('Please enter the radius of the circle in m : '); ReadLn(radius); area:=monPi*radius*radius; // thanks gikam for the formula 8-) WriteLn('The area value is ',area:16:4,' m²'); WriteLn('done. Saxcool thanks you.'); End. { CircleArea Program } |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








