Advertisement
brainuser5705

factorial in C

Apr 24th, 2021
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main(void){
  4.    
  5.     int n, factorial;
  6.  
  7.     printf("TABLE OF POWERS OF TWO\n\n");
  8.     printf(" n       2 to the n\n");
  9.     printf("---     -------------\n");
  10.    
  11.     factorial = 1;
  12.  
  13.     for (n = 1; n <= 10; ++n){
  14.         printf("%2i         %i\n", n, factorial);
  15.         factorial *= n;
  16.     }
  17.  
  18.     return 0;
  19.  
  20. }
Advertisement
RAW Paste Data Copied
Advertisement