Some Basic C program frequently asked in Interview.
/* Power of a Number*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter a number,and its power\t");
scanf("%d%d",&a,&b);
c=1;
while(b>=1)
{
c=c*a;
b--;
}
printf("%d",c);
getch();
}
No comments:
Post a Comment