You are on page 1of 4

CS10-8L: Computer Programming Laboratory

Machine Problem #14: Loops

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_MP13. Ex. Isip_Cheryl_MP13

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

a. PDF file of Machine Problem 14 provided with the screenshot of your answers.
b. MATLAB 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: Cheryl Isip
Date: August 27,2021
Time: 2:20pm
Program: BSIE
Course: CS10-8L
Section: B20
School: Mapua University
%}

Prepared by: Cheryl Mari M. Isip, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #14: Loops

Problem Statement:

The program will ask for a number. Then will display the odd numbers on that number, Then on
the next line will show the even numbers from the number we have input.
Then Add up all Even numbers…..and Multiply all the Odd numbers

Input Validation:
Input an integer.
In the editor window, take a screenshot and paste your output:

Sample Run:
Input a number: 15
Odd Number: 1 3 5 7 9 11 13 15
Even Number: 2 4 6 8 10 12 14
Sum of Even Numbers: 56
Product of Odd Numbers: 2027025

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

Prepared by: Cheryl Mari M. Isip, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #14: Loops

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

Prepared by: Cheryl Mari M. Isip, Mapua University


CS10-8L: Computer Programming Laboratory
Machine Problem #14: Loops

Prepared by: Cheryl Mari M. Isip, Mapua University

You might also like