Saturday 5 November 2011

evaluate the expression 2.5 log(x) +cos(a)+|x2-y2|+2(xy)1/2

Algorithm:

Step1:         Start


Step2:         Read the values of x,y and a.


Step3:         p=2.5*log(x)+ cos(a*3.14/180)+sqrt(2*x*y)+(x*x-y*y)


Step4:         Print p


Step5:         Stop.


 

 

Program:

#include<stdio.h>


#include<math.h>


main()


   {


int x,y,a;


float s;


printf("\nEnter values for x,y,a :");


scanf("%d%d%d",&x,&y,&a);


s=2.5 * log(x)+ cos(a*3.14/180)+ sqrt(2*x*y) + (x*x-y*y);


printf("\nS = %f",s);


getch();


   }


Output:                            I/P                                               O/P

 

Enter values for x,y,a : 3 2 32                  S = 12.058642


Enter values for x,y,a : 1 1 60                  S = 1.914213



No comments:

Post a Comment