Hi,
I have created program and got correct answer for the operation + - / and * but my program is not giving me result for area of the circle
Could you please correct my program and tell me what is wrong
Thanks a lot
P.S. I am beginner
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Sep 14, 2012, 2:51 PM EDT
double area = Math.PI * radius * radius;
Notice that it's more efficient to multiply the radius by itself than to use the Math.Pow method.
Marta15 reputationPosted Sep 14, 2012, 11:32 PM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 15, 2012, 2:45 PM EDT
This should be OK:
Marta15 reputationPosted Sep 15, 2012, 11:27 PM EDT
Marta15 reputationPosted Sep 15, 2012, 11:28 PM EDT
And now I do not get result of previous operations...
Before coccrection nafter debbuging program gave me result:
Operand 1: ....I can add first number
Operand 2: ...second nimber
Operator: ..for example +
and then I got result. Now they gave me:
Operand: i can type in number
Operand 2: second number
Operator: can add + - etc.
But in stead of calculation, I got
Area of the circle:
VulpesRank #55 · 29.2K reputationPosted Sep 16, 2012, 5:53 AM EDT
But you should be asking the user for the radius and then outputting the area of the circle:
Marta15 reputationPosted Sep 16, 2012, 6:30 AM EDT
It should be simple because num1 should be radius of the circle ....and this num 1 I need to use to calculate before but..
VulpesRank #55 · 29.2K reputationPosted Sep 16, 2012, 6:33 AM EDT
'AreaOfCircle' was just my suggestion.
Marta15 reputationPosted Sep 16, 2012, 6:58 AM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 16, 2012, 10:19 AM EDT
Repost the code if you like - just copy and paste it into the box - no need to upload a .rar file.
Marta15 reputationPosted Sep 16, 2012, 10:38 AM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 16, 2012, 10:57 AM EDT
double area = ConsoleApplication4.Calculator.AreaOfCircle(radius);
If you change the former to AreaOfCircle, then it will compile and work fine.
Marta15 reputationPosted Sep 16, 2012, 11:21 AM EDT