高手帮忙编个程

来源:百度知道 编辑:UC知道 时间:2024/05/12 16:05:47
分支的:假如邮局规定寄邮件时若每件重量在1公斤以内(含1公斤),按每公斤1.5元计算邮费,如果超过1公斤时,其超出部分每公斤加收0.8元。请编程序计算邮件收费。

pascal:
var
s:real;x:integer;
begin
write('Input x:');
readln(x);
if x<=1 then s:=1.5*x else s:=1.5+0.8*(x-1);
write(s);

QB语言
CLS
INPUT N
IF N = 0 THEN END
IF N <= 1 THEN
PRINT 1.5
ELSE
N = N - 1: N = N \ 1
PRINT 1 + N * .8
END IF
END

javascript做的,代码复制保存为html文件就可以直接用了

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>邮件收费计算器</title>
<style type="text/css&q