CGPR
CGPR
Output: -
Clear Function: -
Save Function: -
2. Write a program in MATLAB to enter two arrays and multiply them.
Input: -
fprintf('this is Array1\n')
Array1=[1 2; 3 4]
fprintf('this is an Array2\n')
Array2=[5 6; 7 8]
fprintf('Result Output\n')
fprintf('%%%%%%%%%%%%%%%%%%%%%\n')
ArrayMultiply=Array1*Array2
Output: -
3. Write a program in MATLAB to perform arithmetic operation.
Input: -
Output: -
4. Write a program in MATLAB to enter a date so that program will display a day coming on
that day.
Input: -
Output: -
5. Write a program in MATLAB using while loop.
Input: -
variable=10;
%While loop Exwcution
fprintf('Result output\n')
fprintf('\n')
fprintf('*******************\n')
while(variable<20)
fprintf('The value of variable is:%d\n',variable)
variable=variable+1;
end
Output: -
6. Write a MATLAB program perform switch case.
Input: -
fprintf('Result output\n')
fprintf('\n')
fprintf('***********************\n')
Grade ='A';
switch (Grade);
case 'A'
fprintf('Excellent\n');
case 'B'
fprintf('Well done\n');
case 'C'
fprintf('Well done\n');
case 'D'
fprintf('You Passed\n');
case 'F'
fprintf('Better Try Again\n');
otherwise
fprintf('Invalid Grade\n');
end
Output: -
7. Write a program in MATLAB to comparing two Different values.
Input: -
Output: -
8. Write a program in MATLAB to perform Addition & Subtraction of two vectors.
Input: -
vectorvalue1=[7,11,15,23,9];
vectorvalue2=[2,5,13,16,20];
fprintf('Addition & Subtraction operations\n')
Add=vectorvalue1+vectorvalue2;
Sub=vectorvalue1-vectorvalue2;
fprintf('Result output \n')
fprintf('Result For Addition \n')
disp(Add);
fprintf('Result For Substraction \n')
disp(Sub);
Output: -
9. Write a program in MATLAB declare Global variables and find it average
Input: -
Output: -
10. Write a program in MATLAB to perform function
Input: -
Output: -
11. Write a program in MATLAB to combine string into a cell Array
Input: -
fprintf('result output\n')
fprintf('student detail\n')
name='Akhilesh Khade';
sem= 'Fourth Sem';
workat = 'Chandrapur';
profile = char(name , sem, workat);
profile = cellstr(profile);
disp(profile)
Output: -
12. Write a program in MATLAB to display all prime number from 1 to 50 using for loop.
Input: -
Output: -