-->
Showing posts with label 'n' th power of given expression. Show all posts
Showing posts with label 'n' th power of given expression. Show all posts

program to get 'n' th power of expression

// program to get 'n' th power of given expression
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,n;
float result;
printf(“enter a and b\n”);
scanf(“%f%f”,&a,&b);
printf("enter value of 'n'\n");
scanf("%f",&n);
result=pow((a+b),n); //pow() function exists inside math.h
printf(“the result is=%f\n”,result);
getch();
}


note: this program gives you/us value of
(a+b)2 or (a+b)3 or any other.