0% found this document useful (0 votes)
25 views1 page

Tutorial

This code defines a vector from 1 to 10, loops through each element, squares the number and converts it to a string, then displays "Square of" the original number, followed by "is" and the squared string.

Uploaded by

Arun Sankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Tutorial

This code defines a vector from 1 to 10, loops through each element, squares the number and converts it to a string, then displays "Square of" the original number, followed by "is" and the squared string.

Uploaded by

Arun Sankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Problem 1: (6 marks)

a)

number = 1:1:10;
for i = 1:length(number)
num = number(i);
isquare = num^2;
I = num2str(isquare);
disp('Square of');
disp(num);
disp('is');
disp(I);

You might also like