Tuesday 24 June 2014

45)write a c++ program to read an angle in degrees and evaluate and display its sine and cosine.

#include<iostream>
#include<cmath>
using namespace std;
#define pi 3.14
int main()
{   float x,theta;
    float sx,cx;
    cout<<"ener the angle in degree"<<endl;
    cin>>theta;
    x=(180/pi)*theta;
    sx=sin(x);
    cx=cos(x);
    cout<<"sine of "<<theta<<"is"<<sx;
    cout<<"cosine of "<<theta<<"is"<<cx;
    int i;
    cin>>i;
    return 0;
}

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...