Ex.No:3d Program To Find The Exponent Of The Given Number

AIM:

         To write a c program to find the exponent of the given number.

ALGORITHM:

Step1: Start the program.

Step 2: Enter the X and n Value.

Step 3: Set a loop upto n.

Step 4: Find the exponent value of x

temp= temp* x / i

Sum= sum+ temp

Step 5: After the execution of the loop print the exponent value of x.

Step 6: Stop the program.

PROGRAM CODE:
#include<stdio.h>
void main()
{
    float x,temp=1,sum=1;
    int i,no;
    clrscr();
    printf("n  Enter the numbers:");
    scanf("%f%d",&x,&no);
    for(i=1;i<no;i++)
    {
        temp=temp * x / i;
        sum=sum + temp;
    }
    printf("  Exponent of x is %f",sum);
    getch();
}
OUTPUT:

exponent

RESULT:

                    Thus the c program to find the exponent of the given number is written and executed successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *