0% found this document useful (0 votes)
53 views3 pages

CLC Clear A 0 I 1:1000 X I 2 X A A+x : 'Enter The Number:'

The document contains code snippets that perform calculations using loops and conditional statements. The code defines variables, uses loops to iterate calculations, and conditional statements like if/elseif/else to perform different operations depending on variable values. The code samples demonstrate basic programming concepts like input, output, loops, conditional logic, and variable assignment.

Uploaded by

Tabi4every1
Copyright
© Attribution Non-Commercial (BY-NC)
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)
53 views3 pages

CLC Clear A 0 I 1:1000 X I 2 X A A+x : 'Enter The Number:'

The document contains code snippets that perform calculations using loops and conditional statements. The code defines variables, uses loops to iterate calculations, and conditional statements like if/elseif/else to perform different operations depending on variable values. The code samples demonstrate basic programming concepts like input, output, loops, conditional logic, and variable assignment.

Uploaded by

Tabi4every1
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

2.

clc;
clear;
a=0;
for i=1:1000;
x=i^2;
x
a=a+x;
end;

Output

3.
clc;
clear;
a=0;
a=input('enter the number:');
if a<0;
y=sqrt(a^5+1);
elseif a<=10 || a>=0;
y=3^a+1;
elseif a>=10;
y=9*sin(5^a-50)+31;
else
print('Entered value cant be operated');
end
a
y

Output

A=-5

a=5

a=15

4.
clc;
clear;
a=0;
a=input('enter the number:');
disp('value at');
a
if a<-1;
y=exp(a)+1;
elseif a>=-1 && a<=5;
y=2+cos(pi*a);
elseif a>=5;
y=10*(a-5)+1;
else
print('Entered value cant be operated');
end
y

Output

A=-5
5.
clc;
clear;
a=0;
for k=1:10;
k
x=5*k*3;
y=a+x;
a=x+y;
end
a

output

A=3

A=15

6.
clc;
clear;
x=0;
a=0;
while x<1e+4;
a=a+1;
x=5*a^2-2*a+x;
end
disp('terms')
disp(a)
disp('sum')
disp(x)

output

7.
clc;
clear;
x=0;
a=0;
while x<2000;
a=a+1;
x=3*a^2+a;
end
disp('terms')
disp(a/2)
disp('sum')
disp(x)

output

Solved lab#5

You might also like