Tuesday, September 20, 2011

WAP to calculate trigonometric functions


/*
  Name: WAP to calculate trigonometric functions
  Author: Parveen Malik
  Date: 20/09/11 09:43
*/


#include <stdio.h>
#include <conio.h>
#include <math.h>
 void main()  
 {  
      float x;  
      char t;   
 printf("Enter the Value of X\n");  
 scanf("%f",&x);  
 x=(x*3.14)/180;  
 printf("\n\nEnter \ns For finding sin(x)\nc For finding cos(x)\nt For finding tan(x)\n\n");  
 scanf(" %c",&t);  
 switch (t)  
 {  
 case 'S':  
 case 's':                      
      printf("\nThe Value is = %f",sin(x));  
      break;  
 case 'C':  
 case 'c':  
 printf("\nThe Value is = %f",cos(x));  
 break;  
 case 'T':  
 case 't':  
 printf("\nThe Value is = %f",tan(x));  
 break;  
 default:  
 printf("\nInvalid Choice");  
 }  
 getch();  
 } 

OUTPUT: 


2 comments:

Post a Comment