0% found this document useful (0 votes)
120 views

CS10-8L: Computer Programming Laboratory Machine Problem #9: Conditional Statements

This document provides instructions for a MATLAB programming assignment on conditional statements. Students are asked to write a program that checks whether an arithmetic expression of the form a # b = c is possible by replacing # with a mathematical operator. The program should prompt the user to input values for a, b, and c, then output whether the expression is true or false. Several sample runs are provided to demonstrate expected input/output pairs.

Uploaded by

Raynard Yu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

CS10-8L: Computer Programming Laboratory Machine Problem #9: Conditional Statements

This document provides instructions for a MATLAB programming assignment on conditional statements. Students are asked to write a program that checks whether an arithmetic expression of the form a # b = c is possible by replacing # with a mathematical operator. The program should prompt the user to input values for a, b, and c, then output whether the expression is true or false. Several sample runs are provided to demonstrate expected input/output pairs.

Uploaded by

Raynard Yu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CS10-8L: Computer Programming Laboratory

Machine Problem #9: Conditional Statements

Name: Score:

Section: Date:

OBJECTIVES
● To familiarize the students with the MATLAB interface.
● To enable the students to use some basic operations.

Instructions:
1. Save your file as Surname_Firstname_MP9. Ex. Santos_Jared_MP6

2. You will submit a zip file containing the following and send it to BB.

a. PDF file of Machine Problem 8 provided with the screenshot of your answers.
b. MATLAB function script with .m extension.

3. Your program must have comments for each section.


Header Comments:
%{
This demo program shows how good a MATLAB program is
Written by: Raymond Sedilla
Date: August 27,2020
Time: 2:20pm
Program: BSIE
Course: CS10-8L
Section: B20
School: Mapua University
%}

MACHINE PROBLEM

1. Consider an arithmetic expression of the form a # b = c. Check whether it is possible to replace with one of the
four signs: +, -, * or / to obtain a correct expression.

1st Sample Program Run

Enter value of a: 2
Enter value of b: 3
Enter value of c: 5

Output: True

Note: Output is true because 2 and 3 can result to 5 using +.

Prepared by: Raymond Sedilla, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #9: Conditional Statements

2nd Sample Program Run

Enter value of a: 8
Enter value of b: 3
Enter value of c: 2

Output: False

Note: Output is false because 8 and 3 will not result to 2 using +, -, *, and /.

Test
a b c Expected Output
Sample
1 2 3 5 True
2 8 2 4 True
3 8 3 2 False
4 6 3 3 True
5 5 2 0 False
6 10 2 2 False

Prepared by: Raymond Sedilla, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #9: Conditional Statements

In the editor window, take a screenshot and paste your output:

Prepared by: Raymond Sedilla, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #9: Conditional Statements

In the command window, take a screenshot and paste your output:

Prepared by: Raymond Sedilla, Mapua University

You might also like