Wednesday, February 9, 2011

Chapter 2


 On 1/2/2011, we learn for solving problem

Area of A Circle

ALGORITHM

1. Get the radius of a circle.

2. Calculate the area of circle with 3.14 multiply radius by radius.
3. Display the area of circle.

PSEUDOCODE


1. Read radius.

2. Set the area=3.14*radius*radius
3. Display the area of circle.


#include < iostream.h > // header

Main ( ) // Start body
{ // Open curly bracket
// Declare Variable
float area;
float radius;
// Input 1
COUT <<"Enter radius:">>;
CIN >> radius;
// formula
area=3.14*radius*radius
// output
COUT <<"Answer=" << area;
return 0;
} // close curly bracket
// End body 

P/s = jika berlainan soalan,kena tgok farmula

No comments:

Post a Comment

jangan baca jer...comint arrr...