Finding cosine value in c language.

                  Programme to find cosine value.

Hello friends this is the simple code for finding the cos values in c language.C language provide the inbuilt cos function which is available in math.h header file  and use in finding the cosine value.The following programme fine the cosine value starting from 0 to 180 degree.





                         
https://programminghub1999.blogspot.com/2018/12/cosine-value.html



                                Following method has used in finding the cosine value.

  1. Take the integer angle variable.
  2. Assign it's initial value to zero.
  3. Run the iteration till the maximum value of 180 degree.
  4. Inside the iteration convert degree into radian.
  5. Find the cos value of converted value using cos() function.


                                      Finding cosine value.




#include<stdio.h>
#include<conio.h>
#include<math.h>
#define PI  3.1416
#define MAX 180
void main()
{
    clrscr();
    int angle;
    float x,y;
    angle=0;
    printf("Angle Cos(angle)\n \n");
   while(angle<=MAX)
   {
      x=(PI/MAX)*angle;
      y=cos(x);
      printf("%15d %13.4f\n",angle,y);
      angle=angle+10;
   }
      getch();
}



Finding cosine value in c language. Finding cosine value in c language. Reviewed by Deepak kumar soni on December 24, 2018 Rating: 5

1 comment:

Powered by Blogger.