Answer:
A program that implement a bubble sort:
#include<iostream.h>
#include<conio.h>
int main()
{
int ar[50],no,i,j,temp;
cout<<"Enter array size ";
cin>>no;
cout<<"Enter array elements ";
for(i=0;i<no;++i)
cin>>ar[i];
for(i=1;i<no;++i)
{
for(j=0;j<(no-i);++j)
if(ar[j]>ar[j+1])
{
temp=ar[j];
ar[j]=ar[j+1];
ar[j+1]=temp;
}
}
cout<<"Bubble Sort array";
for(i=0;i<no;++i)
cout<<" "<<ar[i];
return 0;
}
<span>Here is matlab that should work
% cos(x) = 1 - (x^2)/2! + (x^4)/4! -(x^6)/6!+(x^8)/8!...
% let y= x*x
% cos(x) = sum( (-y)^n/(2n)! )
format short
x= 0.3*pi;
y= x*x;
for N= 1:6
n= 0:N;
s1= [(-y).^n./factorial(2*n) ]
mac= sum(s1);
cx= cos(x);
str= sprintf('%d terms. series: %12.10f cos(x): %12.10f\n %12.10f',...
N, mac,cx, (cx-mac));
disp(str);
end;</span>