draft
This commit is contained in:
23
programs/p47/main.c
Normal file
23
programs/p47/main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n <= 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i = 2;
|
||||
|
||||
while (i <= n) {
|
||||
printf("%d ", i);
|
||||
i <<= 1;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user