Home C Programming Language / Programs / power function in c programming language
🚀 Programming Example

power function in c programming language

👁 901 Views
💻 Practical Program
📘 Step Learning
power function in c programming language

💻 Program Code

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

🖥 Program Output

 1^2 = 1
 2^2 = 4
 3^2 = 9
 4^2 = 16
 5^2 = 25
 6^2 = 36
 7^2 = 49
 8^2 = 64
 9^2 = 81
 10^2 = 100
Press any key to continue . . .
                            

📘 Explanation

power function in c programming language
📚 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.