source file name: power.C
#include<stdio.h>
void main()
{
int a,b,n;
int pv=1;
//clrscr();
printf("\n enter two numbers : ");
scanf("%d%d",&a,&b);
for(n=1;n<=b;n++)
{
pv=pv*a;
}
printf("\n %d raised %d power is:%d",a,b,pv);
getch();
}
output:
source file name: power.C
#include<stdio.h>
void main()
{
int a,b,n;
int pv=1;
//clrscr();
printf("\n enter two numbers : ");
scanf("%d%d",&a,&b);
for(n=1;n<=b;n++)
{
pv=pv*a;
}
printf("\n %d raised %d power is:%d",a,b,pv);
getch();
}
output:
0 Comments
Post a Comment