instanceof java
Posts: 576
Nickname: instanceof
Registered: Jan, 2015
instanceof java is a java related one.
C programming power function example program
Posted: May 20, 2017 7:14 AM
This post originated from an RSS feed registered with Java Buzz
by instanceof java.
Original Post: C programming power function example program
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java
Advertisement
C program to find power of a number using function. Write a c program to find power of a number using function recursion
Program #1 : Write a c program to find power of a number without using function recursion #include<stdio.h> int main(){ int power,num,i=1; long int sum=1; printf("Enter a number:\n "); scanf("%d",&num); printf("\nEnter power:\n "); scanf("%d",&power); while(i<=power){ sum=sum*num; i++; } printf("\n%d to the power %d is: %ld",num,power,sum); getch(); } Output: Program #2 : Write a c program to find power of a number using function recursion #include<stdio.h> void powerofnumber(int power, int num); int main(){ int power,num,i=1; long int sum=1; printf("Enter a number:\n "); scanf("%d",&num); printf("\nEnter power:\n "); scanf("%d",&power); powerofnumber(power,num); return 0; } void powerofnumber(int power, int num){ int i=1,sum=1; while(i<=power){ sum=sum*num; i++; } printf("\n%d to the power %d is: %ld",num,power,sum); } Output: Enter a number: 23 Enter power: 3 23 to the power 3 is: 12167
Read: C programming power function example program