Tuesday, February 15, 2011

CHAPTER 1

algorithm (arahan panjang)> pseodocode (arahan pendek)> flowchart> programming c++

example 1
find the area of rectangle

area=width * height

algorithm
1.get the width of rectangle
2.get the height of rectangle
3.calculate the area of rectangle with multiply width by height
4.display the area of rectangle

pseodocode
1.read width
2.read height
3.set the area = width * height
4.print output

flowchart
read width > read height > set the area = width * height > print output > end

example 2
find the area of celcius

celcius = (5/9) * (fahrenheit-32)

algorithm
1.get the fahrenheit of celcius
2.calculate celcius equal to five devide by name multiply by fahrenheit minus 32
3.display the area of celcius

pseudocode
1.read fahrenheit
2.set the celcius = (5/9) * (fahrenheit -32)
3.print output

flowchart
start > read radius > area 3.14 * radius * radius > print output > end

example 3
find the area of fahrenheit

fahrenheit = (9/5 * ( celcius + 32) )

algorithm
1.get the celcius of fahrenheit
2.calculate fahrenheit equal nine devide by five multiply celcius plus 32
3.display fahrebheit

pseudocode
1.read celcius
2.set the fahrenheit ( 9/5 * ( celcius + 32 ) )
3.print output

flowchart
start > read celcius > set the area = ( 9/5 * ( celcius + 32 )  ) > print output > end

No comments:

Post a Comment