1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Thai dinh chinh DE170147 lap 05

5 2 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 260,67 KB

Nội dung

Thai Dinh Chinh DE170147 Lap Week 5 USE SIMPLE MENU TO MANAGE PROGRAM FUNCTIONS THAI DINH CHINH DE170147 CSI201 Lap W5 Quadratic equation Start Read a, b, and c values Compute d = b2 4ac if d > 0 then.

CSI201- Lap W5 USE SIMPLE MENU TO MANAGE PROGRAM FUNCTIONS THAI DINH CHINH - DE170147 Quadratic equation Design (Algorithm) Start Read a, b, and c values Compute d = b2 4ac if d > then r1 = b+ sqrt (d)/(2*a) r2 = b sqrt(d)/(2*a) Otherwise if d = then compute r1 = -b/2a, compute r2=-b/2a print r1,r2 values Otherwise if d < then print roots are imaginary Stop Flowchart Bank deposit problem Design (Algorithm) Star Read the amount Read years(months) Read rate Calculate the interest with the formula: "Interest=Amount*Years*Rate/100 Print interest Flowchart Main codes Quadratic equation: Bank deposit problem: float a, b, c, d, r1, r2; float D,r,m,A; printf(" Enter a, b and c where a*x*x + b*x + c = 0: "); BG: scanf("%f %f %f", &a, &b, &c); printf("\n Amount to be deposit in the bank (positive number): "); d = b*b - 4*a*c; scanf("%f",&D); if( d>=0){ printf("\n Enter the rate of interest per year (a positive number

Ngày đăng: 25/10/2022, 14:09

w