clear all;close all;clc;es=0.05*10^-3;sum=0;i=0;ea=1;x=input('Enter x: ');flag=1;while(abs(ea)>es)prev=sum;sum=sum+flag*(x^i)/factorial(i);i=i+2;ea=(sum-prev)/sum;flag=0-flag;endsum
MATLAB: What is the function of flag in this code
MATLAB
Best Answer