Write a program to determine the value of the expression: 2-ye2y+4y. 

Q18. The value of e is known to be 2.71828….. Using this value, write a program to determine the value of the expression: 2-ye2y+4y.  Obtain value of y from user.

Ans.

 #include<iostream.h>  //for standard input and output

#include<conio.h>     //for clrscr();

#include<math.h>      //for pow();

 

//Main function

void main()

{

const double e=2.71828;

double result,y;

 

clrscr();  //for clear screen

 

cout<<“\n Enter value of y: “;

cin>>y;

 

result=2-(y*(pow(e,(2*y))))+pow(4,y);

 

cout<<“\n The result of given expression is: “<<result;

 

getch();   //To hold the output screen

}

//End of main()

 

OUTPUT

 

Enter value of y: 90

The result of given expression is: -1.340283e+80

Leave a Reply

Your email address will not be published. Required fields are marked *

696 Views
%d bloggers like this: