%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% statement_practice.m
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




%% Question 01
% Evaluate the following expressions without using MATLAB. Check the answer with MATLAB.
% a) 14>15/3
% b) y = 8/2<5x3+1>9
% c) y = 8/(2<5)x3+(1>9)
% d) 2+4x3 ~= 60/4?1

%% Question 02
% Given: a = 4, b = 7. Evaluate the following expressions without using MATLAB. Check the answer with MATLAB.
% a) y = a+b>= axb 
% b) y= a+(b>=a)xb
% c) y = b-a<a<a/b

%% Question 03
% A vector is given by: x = [15 -6 0 8 -2 5 4 -10 0.5 3]. 
% Using conditional statements and loops, write a program 
% that determines and displays the sum of the positive elements of the vector, 
% and the sum of the negative elements of the vector.



%% Question 04
% Write a MATLAB if statement to calculate f(x)
% The value of f(x) is -2x when x < 0; x(x-2) when x is in [0, 2] and log(x-1) otherwise. 



%% Question 05
% Write a program in a script file that finds the smallest even integer that is also divisible by 7 
% and whose cube is greater than 40,000. 
% Use a loop in the program. The loop should start from 1 and stop when the number is found. 
% The program prints a message: ?
% The required number is: ?
% and then prints the number.

% hint: assume a is an integer, a/7,
% dimension of the cube = length x width x height; a^3 > 40,000
% use fprintf

%% Question 06
% Write a function 'runsum = sum_1_to_n(n)' return the sum of integers from 1 to n
% save a script

% hint: use for end
% hint: set runsum = 0 before the loop



%% Question 07
% Calculates the overall sum of the elements
% hint: two loops (for, for)
% use following commands
mat = [3:5; 2 5 7]
[row col] = size(mat);
i= row
j = col

outsum = 0;
outsum = outsum + mat(i,j)

%% Question 08
% Write a script that will prompt the user for a temperature in degree
% Celsius, and then an F for Fahrenheit or K for Kelvin
% The script will print the corresponding temperature in the scale specified by the user. 
% For example, the output might look like this:
% Enter the temp in degrees C: 29.3
% Do you want F or K? F
% The temp in degrees F is 84.7

% The format of the output should be exactly as specified here. The conversions are:
% F = 9/5*C+32
% K = C +273.15

% hint: switch









