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