救急~~~Pascal 既program

2007-03-24 6:22 am
-Use at most 2 variables to read three numbers and display the total
-sample output:

Total = 0.0
Enter number 1: (24.2) ( )即係要read既野
Total = 24.2
Enter number 2: (12.8)
Total = 37.0
Enter number 3: (63)
Total = 100.0

回答 (2)

2007-03-24 7:04 am
✔ 最佳答案
program total
var x, y : real;

begin
readln(x);
write('Enter number1: ');
readln(x);
writeln('Total=',x);
write('Enter number2: ');
readln(y);
x := x+y;
writeln('Total=',x);
write('Enter number1: ');
readln(y);
x := x+y;
writeln('Total=',x);
end.
參考: 自己
2007-03-28 7:22 am
你冇老慮到印出來的格式應該是小數後一位, 現在這樣寫會以科學記數法表示。而且格式亦與上面要求的有些出入。


收錄日期: 2021-04-12 21:13:32
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070323000051KK04316

檢視 Wayback Machine 備份