ช่วยเขียนโปรแกรมPascal หน่อยคับ

ขอบคุณมากกกกกกกกกกกกกกกกกกกกกกกกกกกกคร๊าพพพพพพพพพพพพพ

💬 การตอบกลับ 2

#1
Moshi
Moshi
16,996 โพสต์
โปรแกรมคำนวณว่า มีเงินเท่านี้ ได้ธนบัตร อะไรบ้าง กี่ใบๆ ประมาณนี้คับ

อันนี้ เป็นภาษา Pascal เลยนะครับ รันได้ ใช้แทนโค๊ดเทียมเลยก็ได้คับ

Flowchart >> Download

program it4x_thanabut;
uses crt;
var a,b,c,d,e,f,g,h,money:longint;
begin
    clrscr;
    write('Input Your Money := ');readln(money);
    repeat
    if money>=1000 then
    begin
         money := money-1000;
         a := a+1;
    end
    else
    if money>=500 then
    begin
         money := money-500;
         b := b+1;
    end
    else
    if money>=100 then
    begin
         money := money-100;
         c := c+1;
    end
    else
    if money>=50 then
    begin
         money := money-50;
         d := d+1;
    end
    else
    if money>=20 then
    begin
         money := money-20;
         e := e+1;
    end
    else
    if money>=10 then
    begin
         money := money-10;
         f := f+1;
    end
    else
    if money>=5 then
    begin
         money := money-5;
         g := g+1;
    end
    else
    if money>=1 then
    begin
         money := money-1;
         h := h+1;
    end;
    until money<=0;
    clrscr;
    writeln('Your 1000 := ',a);
    writeln('Your 500 := ',b);
    writeln('Your 100 := ',c);
    writeln('Your 50 := ',d);
    writeln('Your 20 := ',e);
    writeln('Your 10 := ',f);
    writeln('Your 5 := ',g);
    writeln('Your 1 := ',h);
    readln;
end.

✏️ แก้ไขล่าสุด: 3 มกราคม 2553

#2
bleachdeath
bleachdeath
5 โพสต์
ขอบคุณมากๆๆๆๆคร๊าพพพพพพพพพพพพพพพพ