pages

Friday, 9 April 2021

c-program to calculate the number ,and getting values of base and power from the user in c-programming.

 program to calculate the number ,and getting values of base and power from the user in c-programming.

#include<stdio.h>
#inlcude<conio.h>
void main()
{
    int p,b,i,n=1;
    printf("enter the base of the number");
    scanf("%d",&b);
    printf("enter the power of the number");
    scanf("%d",&p);
    for(i=p;i>=1;i--)
    {
        n=n*b;
    }
    printf("the number is %d",n);
    getch();
}

output :- base of the number is 2
               power of the number is 5
                       the number is 32

No comments:

Post a Comment