Power series of 2 using c programming language

C Programming Language / Function in C Language

1022

Program:

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

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
 2^11 = 2048
 2^12 = 4096
 2^13 = 8192
 2^14 = 16384
 2^15 = 32768
 2^16 = 65536
 2^17 = 131072
 2^18 = 262144
 2^19 = 524288
 2^20 = 1048576
Press any key to continue . . .

Explanation:

Power series of 2 using c programming language

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.