1,105,310 Community Members

Pseudocode for area and diameter of circle

Member Avatar
beverlyjojohnso
Newbie Poster
1 post since Jan 2007
Reputation Points: -1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-2
 

<< split from here >>

I need help writing a pseuocode for the following statement:

pseudocode that represents the logic of a program that allows a user to enter a value for the radius of a circle and then provides the user with a choice between printing either the diameter or the circumference of the circle. Based on the user’s choice, the program should calculate the appropriate dimension and display the result. To calculate the diameter, multiply the radius by 2 and to calculate the circumference multiply the diameter by 3.14.

Member Avatar
John A
Vampirical Lurker
5,285 posts since Apr 2006
Reputation Points: 1,896 [?]
Q&As Helped to Solve: 408 [?]
Skill Endorsements: 12 [?]
Team Colleague
 
0
 

Did you read what Dani (cscgal) said? She actually explained pseudocode pretty well.

Also, did you read this announcement?
http://www.daniweb.com/techtalkforums/announcement8-2.html

Show us how far you've gotten. We aren't here just to do other people's homework.

Member Avatar
fesago90
Newbie Poster
21 posts since Jan 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

EDIT: So embarrassing I won't even mention what I'm editing.

Member Avatar
Lerner
Nearly a Posting Maven
2,416 posts since Jul 2005
Reputation Points: 579 [?]
Q&As Helped to Solve: 407 [?]
Skill Endorsements: 16 [?]
 
0
 

>>I think I will have to use a formula that will divide the number of seconds into hours, seconds into minutes, and the remainder will be seconds.

Yup, pretty close. You can use division, modulo, and/or subtraction in sequence to do what is needed.

NumberOfHours is InputSeconds divided by NumberOfSecondsInHour. Since this will be integer division there won't be any decimal point remainder.

After determining NumberOfHours, then you can determine the remaining seconds as follows: RemainingSeconds equals the remainder of InputSeconds divided by NumberOfSecondInHour (in C and C++ the remainder of a division involving two int variables can be obtained by using the modulo operator. So if num = 5 % 2, then num equals 1 since 1 is the remainder of 5 divided by 2) OR, if you don't want to use the modulo operator you could use RemainingSeconds equals InputSeconds minus the product of NumberOfHours times NumberOfSecondsInHour.

You can do a similar type formula for determining number of minutes.

Member Avatar
fesago90
Newbie Poster
21 posts since Jan 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

(thread is from 2004)

Member Avatar
kommissioner1
Newbie Poster
1 post since Sep 2010
Reputation Points: -2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

help me write psydo code for circle

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article