to extract the functions already created in file math.h (eg:- sqrt , pow , sin etc..) .
Line ans = pow(a,n) stores the value of a^n in ans which is displayed in last line .
Line ans = pow(a,n) stores the value of a^n in ans which is displayed in last line .
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Program to find a^n.
#include<stdio.h>#include<conio.h>
#include<math.h>
void main()
{ float a,n,ans;
clrscr();
printf("\n program to calculate a^n (a raise to power n)");
printf("\n\n enter value of a :");
scanf("%f",&a);
printf("enter value of n : ");
scanf("%f",&n);
ans = pow(a,n);
printf("\n\n ans of a^n = %f",ans);
getch();
}

No comments:
Post a Comment
Guys if you think something is wrong or should be edit than please do comment.