Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Summer Olympics years Since 1 8 9 6 , the Summer Olympic Games have been held every 4 years, with a few exceptions for global

Summer Olympics years
Since 1896, the Summer Olympic Games have been held every 4 years, with a few exceptions for global impact events (ex: WWI, WWII, and the 2019/2020 global pandemic).(source)
Write a program to determine if a given random year between 1948 and 2019 has held a Summer Olympic Games. Use relational operators to assign 'true' to the logical variable summerOlympicsYear if the variable year is greater than or equal to 1948 and is divisible by 4. Otherwise, the variable summerOlympicsYear should be assigned the logical value 'false'.
Ex: Given:
year =2000
then the output of the program is:
summerolympicsYear = logical 1
For this program, use the Matlab command mod (source), which returns the remainder of the division of two given values.
b=mod(a,m) returns the remainder of the division of abym.
Ex:
remainder =mod(4,2)
results in
remainder =
Script 0
B Save
C Reset
MATLAB Documentation
1% year is randomly generated between 1948 and 2019.
year = randi ([1948,2019],1);
% summerolympicsYear should be assigned logical variable true if the year
% is greater than or equal to 1948 and divisible by 4
summerolympicsYear =
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions