C Program: Enter the Number and its Power and Compute the Result

Engg.... | 01:18 | | | Best Blogger Tips
exponents

Functions of Header files:
  • stdio.h  Stands for standard I/O Header File.
  • conio.h Stands for consol I/O Header File.
  • .h indictes the Extension of the Header File.
  • <stdio.h> Header File includes scanf() and printf() Functions.
  • <conio.h> Header file includes clrscr() and getch() Functions.

Statement of C program: Enter a Number and its Exponent and Show the Result.


#include<stdio.h>
#include<conio.h>

void main()
{
int a,b,c,d ;
clrscr();
printf("Enter the number:\n ");
scanf("%d" ,&a);
printf(" Enter the Power of number:\n");
scanf(" %d" , c);
d=a;
for(b=2 ; b<=c ; b++)
{
a=a*d;
}
printf(" Result=%d" , a);
getch();
}

Output:
Enter the number:
5
Enter the Power of number:
3
Result=125 


Please Share it! :)
Do you like this Story?

Get Free Email Updates Daily!

Follow us!

0 comments:

Post a Comment