diff options
Diffstat (limited to '3808/CH2/EX2.3/Ex2_3.sce')
-rw-r--r-- | 3808/CH2/EX2.3/Ex2_3.sce | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/3808/CH2/EX2.3/Ex2_3.sce b/3808/CH2/EX2.3/Ex2_3.sce new file mode 100644 index 000000000..7ad179dc1 --- /dev/null +++ b/3808/CH2/EX2.3/Ex2_3.sce @@ -0,0 +1,34 @@ +//Chapter 02:Basic Structures: Sets, Functions, Sequences, Sums and Matrices + +clc; +clear; + +n=input("Enter the no. of terms in the sequence to generate the GP:"); +i=1 +mprintf("\nThe list of terms:") +for i=0:n + mprintf("b%d ,\t",i) +end +mprintf("begins with ") +for i=0:n //iterate for the number of terms given as input + b_n=(-1)**i + mprintf("%d ,",b_n) +end +mprintf("\nThe list of terms:") +for i=0:n + mprintf("c%d ,\t",i) +end +mprintf("begins with ") +for i=0:n //iterate for the number of terms given as input + c_n=2*(5**i) + mprintf("%d ,",c_n) +end +mprintf("\nThe list of terms:") +for i=0:n + mprintf("c%d ,\t",i) +end +mprintf("begins with ") +for i=0:n //iterate for the number of terms given as input + d_n=6.0*((1.0/3.0)**i) + mprintf("%f ,",d_n) //prints the fraction values in decimals. Floating point division +end |