Created
March 25, 2020 17:51
-
-
Save Redeem-Grimm-Satoshi/b7cbb5acdd95a76ebdc101a2c53d4e76 to your computer and use it in GitHub Desktop.
Compute Powers Of 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*Author: Redeem Grimm | |
*File Name: PowersOf2.c | |
*Purpose: Computes The Powers Of Two | |
**/ | |
#include<stdio.h> | |
int main(){ | |
//variables | |
int base,exponent,count=0,Power=1; | |
//prompting and getting input from user | |
printf("Enter Base: "); | |
scanf("%d",&base); | |
printf("Enter Exponent: "); | |
scanf("%d",&exponent); | |
printf("Here Are The First %d Powers Of %d:\n",exponent,base); | |
//loop | |
while(count<=exponent-1){ | |
printf("%d^%d=%d\n",base,count,Power); | |
Power*=base; | |
//increment | |
count++; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment