COMPUTER SCIENCE C++

f) Write a C++ function SUMFUN( ) having two parameters Y(of type double) and m(of type integer) with a result type as double to find the sum of the series given below:Y + Y3 / 2! + Y5 /3! + ------ + Y 2m-1 / m!

#include<iostream.h>
#include<math.h>
#include<conio.h>
double SUMFUN(int y1,int m1);
void main()
{ int y;
int m;
clrscr();
cout<<"Enter the vaue of Y and M";
cin>>y>>m;
cout<<”\nThe sum of the series =“<<SUMFUN(y,m);
getch();
}
double SUMFUN(int y1,int m1)
{ double sum=0;
double upper;
for(int i=1;i<=m1;i++)
{ int f=1;
for(int j=1;j<=i;j++)
{ f=f*j;
}upper=pow(y1,(i*2-1));
sum=sum+upper/f;
}
return sum;
}

2002:

1.b) Name the header files of C++ to which the following functions belong:2(i)get( ) (ii)open( ) (iii)abs( ) (iv)strcat( )

2

Ans:

(i) get( ) - iostream.h
(ii) open( ) - fstream.h
(iii) abs( ) - math.h, stdlib.h
(iv) strcat( ) - string.h

1.c) Find the syntax error(s), if any, in the following program.

#include<iostream.h>
void main( )
{ int x;
cin>>x;
for( int y=0,y<10,y++)
cout<<x+y;
}

2

Ans:

#include<iostream.h>
void main( )
{ int x;
cin>>x;
for( int y=0;y<10;y++)
cout<<x+y;
}

 

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( mrkdata@yahoo.com )


Warning: include_once(../../ebooks-footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp15.php on line 130

Warning: include_once(): Failed opening '../../ebooks-footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp15.php on line 130

Warning: include_once(../../../footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp15.php on line 132

Warning: include_once(): Failed opening '../../../footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp15.php on line 132