Flowchart Design for Problem-Solving in Computer Science, Exercises of Mathematics

This document from the HCMC University of Technology covers the practice of drawing flowcharts to design resolution strategies for solving problems using computers. It includes sample exercises on finding the maximum between two numbers, converting between meters and inches, and calculating the circle's diameter, circumference, and area. The document also outlines exercises on finding the smallest number in a group of three, checking the position of a point relative to a circle, solving quadratic equations, computing the average of a group of numbers, and determining the type of a triangle. Additionally, it includes more advanced exercises on solving linear equations using Cramer's rule, checking if a year is a leap year, and calculating the factorial of an integer.

Typology: Exercises

2015/2016

Uploaded on 05/07/2023

15-anh-khoa
15-anh-khoa 🇻🇳

2 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
HCMC UNIVERSITY OF TECHNOLOGY, VNU-HCM
Faculty of Computer Science and Engineering
Lab 1
In this week, we practice drawing flowcharts to know how to design a resolution strategy in order to
solve the problem by computer. Students can see some sample exercises and must prepare solutions
for all exercises in part B.
A. Sample exercises.
Exercise 1. Design an algorithm in flowchart to read and find maximum between 2 numbers.
Solutions:
Prototype: Max(float x, float y)
Flowchart:
Figure 1. Determine maximum between 2 numbers
Introduction to Computing CO1005 – Semester 1 of 2019-2020 1/4
pf3
pf4

Partial preview of the text

Download Flowchart Design for Problem-Solving in Computer Science and more Exercises Mathematics in PDF only on Docsity!

Faculty of Computer Science and Engineering

Lab 1

In this week, we practice drawing flowcharts to know how to design a resolution strategy in order to solve the problem by computer. Students can see some sample exercises and must prepare solutions for all exercises in part B. A. Sample exercises. Exercise 1. Design an algorithm in flowchart to read and find maximum between 2 numbers. Solutions: Prototype: Max(float x, float y) Flowchart: Figure 1. Determine maximum between 2 numbers

Faculty of Computer Science and Engineering Exercise 2. Design an algorithm in flowchart to convert between meters and inches. (Hint: 1 inch = 2,54 cm). Solutions: Prototype : floatconvert (float a,int sel); // sel =1: inches to meter, sel ≠1: meter to inches Flowchart : Figure 1. Converter between meters and inches Figure SEQ Figure * ARABIC 2. Converter between meters and inches Start Input sel m a*2.54/ Print in meter: m Stop

sel=1?

Ye

s

Input a inc a*100/2. Input a Print in inch: inc

No

Faculty of Computer Science and Engineering B. Exercises must to do. Exercise 4. Design an algorithm in flowchart to find the smallest number in a group of three real numbers. Exercise 5. Design an algorithm in flowchart to check whether a point A(x, y) is on, inside or outside the circle with center O(x0, y0) and radius of size R. Exercise 6. Design an algorithm in flowchart to solve the quadratic equation: ax^2 + bx + c =0 with the inputs a , b , and c. Exercise 7. Design an algorithm in flowchart to read in a group of N numbers and compute the average of them, where N is also an input. Exercise 8. Design an algorithm in flowchart to determine if a triangle is equilateral, isosceles, right-angled or isosceles right-angled triangle when a,b,c - the lengths of three sides of this triangle - are given. Exercise 9. Design an algorithm in flowchart to calculate the average of four grades of four subjects of a student and determine whether students “Pass” (>=60) or “Fail”. C. Exercises in advanced. Exercise 10. A set of linear equations: aX + bY = c dX + eY = f can be solved using Cramer’s rule as: X = (ce – bf)/(ae – bd) Y = (af – cd)/(ae – bd) Design an algorithm in flowchart to read in a, b, c, d, e and f and then solve for X and Y. Exercise 11. Design algorithm to check if a given year is leap year or not.(Leap year is divisible by 4 but not by 100 or divisible by 400.) Hint: leap year is the year divisible by 4 but not divisible by 100, or it is divisible by 400. Exercise 12. Design an algorithm in flowchart to read and calculate factorial of integer N.