Sunday, 9 March 2014

write a program that takes a number from user and calculates its logarithm value to the base 10 and e, exponentiation, sin value, cosine value and square root.

write a program that takes a number from user and
calculates its logarithm value to the base 10 and
e, exponentiation, sin value, cosine value and
square root.

Code for program that takes a number from user and calculates its logarithm value to the base 10 and e, exponentiation, sin value, cosine value and square root in C Programming

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
        float n,log,ex,sinv,cosv,sq;
        clrscr();
        printf("\n\n PLEASE ENTER THE VALUE OF N: ");
        scanf("%f",&n);
        log=log10(n);
        ex=exp(n);
        sinv=sin(n);
        cosv=cos(n);
        sq=sqrt(n);
        printf("\n\n THE VALUE OF N IS %.4f .",n);
        printf("\n\n THE VALUE OF LOGARITHAM BASE 10 IS %.4f .",log);
        printf("\n\n THE VALUE OF EXPONENTIATION IS %.4f .",ex);
        printf("\n\n THE VALUE OF SIN VALUE IS %.4f .",sinv);
        printf("\n\n THE VALUE OF COSINE VALUE IS %.4f .",cosv);
        printf("\n\n THE VALUE OF SQURE ROOT IS %.4f .",sq);
    getch();
}


*********************** OUTPUT*************************************************

     PLEASE ENTER THE VALUE OF N: 5


     THE VALUE OF N IS 5.0000 .

     THE VALUE OF LOGARITHAM BASE 10 IS 0.6990 .

     THE VALUE OF EXPONENTIATION IS 148.4132 .

     THE VALUE OF SIN VALUE IS -0.9589 .

     THE VALUE OF COSINE VALUE IS 0.2837 .

     THE VALUE OF SQURE ROOT IS 2.2361 .

No comments:

Post a Comment