1 / 4

อัลกอริธึม เริ่มต้นทำงาน กำหนดค่า จำนวนเงินที่ชำระ (Price) เท่ากับศูนย์

Lab 2_1 ให้นักศึกษาเขียนโปรแกรมภาษาซี ในการคำนวณราคา สินค้า จาก Algorithm, Pseudo Code และ Flowchart ด้านล่าง. อัลกอริธึม เริ่มต้นทำงาน กำหนดค่า จำนวนเงินที่ชำระ (Price) เท่ากับศูนย์ รับข้อมูล จำนวนสินค้า (Amt) = 105 และ ราคา (Cost ) = 299

ashton
Download Presentation

อัลกอริธึม เริ่มต้นทำงาน กำหนดค่า จำนวนเงินที่ชำระ (Price) เท่ากับศูนย์

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab 2_1 ให้นักศึกษาเขียนโปรแกรมภาษาซี ในการคำนวณราคาสินค้า จาก Algorithm, Pseudo Code และ Flowchart ด้านล่าง • อัลกอริธึม • เริ่มต้นทำงาน • กำหนดค่า จำนวนเงินที่ชำระ(Price) เท่ากับศูนย์ • รับข้อมูล จำนวนสินค้า (Amt)= 105 และ ราคา (Cost) = 299 • คำนวณจำนวนเงินที่ชำระ จาก Price = Amt x Cost • แสดงผล จำนวนที่ต้องชำระ • จบการทำงาน รหัสเทียม (Pseudo Code) Begin Price = 0 Amt = 105, Cost = 299 Price = Amt x Cost Write Price End

  2. START Price = 0 Price = Amt*Cost STOP Flowchart คำนวณราคาสินค้า Amt=105, Cost=299 WRITE Price

  3. Lab2_2 ให้นักศึกษาเขียนโปรแกรมคำนวณค่าเฉลี่ย ของอุณหภูมิ จาก Algorithm, Pseudo Code และ Flowchart ทีให้ด้านล่าง • อัลกอริธึม • เริ่มต้นทำงาน • กำหนดค่า อุณหภูมิเฉลี่ย (AvgTmp) เท่ากับศูนย์ • อุณหภูมิสูงสุด(MxTmp)= 55 และต่ำสุด(MnTmp) = 9 • คำนวณ อุณหภูมิเฉลี่ย จากผลรวมอุณหภูมิสูงสุดและต่ำสุดหารสอง • แสดงผล อุณหภูมิเฉลี่ย • จบการทำงาน รหัสเทียม (Pseudo Code) Begin AvgTmp = 0 MxTmp=55, MnTmp=9 AvgTmp=(MxTmp+MnTmp)/2 Write AvgTmp End

  4. START AvgTmp = 0 AvgTmp = (mxTmp+MnTmp)/2 STOP Flowchart คำนวณค่าเฉลี่ยของอุณหภูมิ MxTmp=55,MnTmp=9 WRITE AvgTmp

More Related