Tuesday, November 18, 2014

power using LOOP

 

power using LOOP
#include <stdio.h>
int main()
{
    int base, exp,i,po=1.00;
    printf("Enter base number: ");
    scanf("%d",&base);
    printf("Enter power number: ");
    scanf("%d",&exp);
    for(i=1;i<=exp;i++)
    {
        po=po*base;
    }
 
    printf("%d^%d = %d", base, exp,po);
    return 0;
}

No comments:

Post a Comment