summaryrefslogtreecommitdiff
path: root/3808/CH2/EX2.12/Ex2_12.sce
blob: 3b386f9545d8101d2824eaa9f7d6237f1206ed63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Chapter 02:Basic Structures: Sets, Functions, Sequences, Sums and Matrices

clc;
clear;

k=4 //lower limit
sum_a=0
mprintf("The value for the sequence ")
for k=4:8
    if (k==8) then
        mprintf("(-1) ** %d ",k)
        else
    mprintf("(-1) ** %d +",k)
end
sum_a=sum_a + ((-1) ** k)
end
mprintf("=%d",sum_a)