Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Mathematics ProgramRSS Feeds

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

Posted By: Ruairidh Anderson     Category: C Programming     Views: 4630

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 .


********************************************************************************
  
Share: 



Ruairidh Anderson
Ruairidh Anderson author of 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 is from Perth, Australia.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!