C Program to find Square Root, Logarithmic Value and Exponential Value of Given Number

Program


#include<stdio.h>
#include<conio.h>
#include<math.h>

int main()
{
	 float num, sq,lg, lg10, ex;
	 clrscr();
	 printf("Enter number: ");
	 scanf("%f", &num);
	 sq = sqrt(num);
	 lg = log(num);
	 lg10 = log10(num);
	 ex = exp(num);
	 printf("Square root of %0.2f is: %0.2f\n", num, sq);
	 printf("Natural log of %0.2f is: %0.2f\n", num, lg);
	 printf("Log base 10 of %0.2f is: %0.2f\n", num, lg10);
	 printf("Exponential value of %0.2f is: %0.2f\n", num, ex);
	 getch();
	 return(0);
}

Output

Enter number: 5 ↲
Square root of 5.00 is: 2.24
Natural log of 5.00 is: 1.61
Log base 10 of 5.00 is: 0.70
Exponential value of 5.00 is: 148.41


Note: ↲ indicates ENTER is pressed.