Write a program to find the value of Cosign in C
#include<stdio.h>
#include<math.h>
#define pi 3.1416
#define MAX 180
void main()
{
int angel;
float a=0.0,b=0.0;
printf("Enter the value of Angel: ");
scanf("%d",&angel);
if(angel<=MAX)
{
a=(pi/MAX)*angel;
b=cos(a);
printf("The vaule of %d is: %0.4f",angel,b);
}
//printf("The vaule of %d is: %f",angel,b);
}
#include<stdio.h>
#include<math.h>
#define pi 3.1416
#define MAX 180
void main()
{
int angel;
float a=0.0,b=0.0;
printf("Enter the value of Angel: ");
scanf("%d",&angel);
if(angel<=MAX)
{
a=(pi/MAX)*angel;
b=cos(a);
printf("The vaule of %d is: %0.4f",angel,b);
}
//printf("The vaule of %d is: %f",angel,b);
}
#include
ReplyDelete#define PI 3.1416
#define MAX 180
main()
{
int angle;
float x,y;
printf("Enter the angle:\n");
while (scanf("%d",&angle)==1)
{
x = (PI / MAX) * angle;
y = cos(x);
printf(" The angle is: %d\n The value is: %f\n", angle,y);
if(angle>=180)
{
break;
}
}
}