Home C Programming Language / Programs / Power function in c programming language || pow(2,i)
🚀 Programming Example

Power function in c programming language || pow(2,i)

👁 1,037 Views
💻 Practical Program
📘 Step Learning
Power function in c programming language pow(2,i)

💻 Program Code

  
#include<stdio.h>
#include<math.h>
void main()
{
    int i,m;
    for(i=1; i<=10;  i++)
    {
    	m = pow(2,i);
        printf(" 2^%d = %d \n",i,m);
        
    }
   
} 
                        

🖥 Program Output

 2^1 = 2
 2^2 = 4
 2^3 = 8
 2^4 = 16
 2^5 = 32
 2^6 = 64
 2^7 = 128
 2^8 = 256
 2^9 = 512
 2^10 = 1024
Press any key to continue . . .
                            

📘 Explanation

Power function in c programming language pow(2,i)
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.