//Find addition of n terms of series
// 1+ x^2/2! + x^4/4! + x^6/6! +....
n=input("Enter natural number:")
x=input("Enter real number:")
s=0
temp=1
j=1
for i=1:n
s=s+temp
temp=temp*(x^2)/j*j+1
j=j+2
end
disp(s,"Addition is:")
Output
-->exec('D:\Scilab prog by me\prac5.sce', -1)
Enter natural number:4
Enter real number:3
Addition is:
922.
// 1+ x^2/2! + x^4/4! + x^6/6! +....
n=input("Enter natural number:")
x=input("Enter real number:")
s=0
temp=1
j=1
for i=1:n
s=s+temp
temp=temp*(x^2)/j*j+1
j=j+2
end
disp(s,"Addition is:")
Output
-->exec('D:\Scilab prog by me\prac5.sce', -1)
Enter natural number:4
Enter real number:3
Addition is:
922.
No comments:
Post a Comment