LAB3
LAB3
clc;
clear;
disp('Choose a mathematical operation ')
disp('1. Addition (+)');
disp('2. Subtraction (-)');
disp('3. Multiplication (*)');
disp('4. Division (/)');
choice = input('(1-4)');
if choice < 1 || choice > 4
disp('Enter a number between 1 and 4');
else
% ادخال الرقم األول والرقم الثاني
num1 = input('Enter the first number ');
num2 = input('Enter the second number ');
% طباعة الناتج
fprintf('result: %.2f %s %.2f = %.2f\n', num1,
operator, num2, result);n
end