fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5. printf("Enter the number: ");
  6. scanf("%d",&n);
  7. int a=1;
  8. for(int i=1;i<=n;i++){
  9. printf("%d ",a);
  10. a=a*2;
  11. }
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5320KB
stdin
10
stdout
Enter the number: 1 2 4 8 16 32 64 128 256 512