For example, I enter the number 5 into the program, and then I knock out five (5) asterisks (*) * on the monitor, please help.
- oneElementary cycle for - Palmervan
- 3Or a clever Tajik, who with a hammer "knocks out on the monitor" stars + foreman, who loves brandy and knows how to count asterisks. Just for fun ... make out questions more adequately! - Grizli
- oneAuthor, are you kidding, or what? - DreamChild
- 2Do not carp at the author. Judging by one of his previous questions, the native language for a person is Portuguese. - avp
|
3 answers
for (int i = 0; i < 5; i++) putchar('*');
- 2Not enough perverted answer to such a simple question! I would do something like Duff's device . - VladD
|
#include <stdio.h> #define N 5 void main() { // Предпочтительно char *asterisk = "**********"; printf("%.*s\n", N, asterisk); // Возможно for (int i = 0; i < N; i++) { printf("*"); } printf("\n"); }
- oneIn the first case, the maximum number of asterisks displayed will be limited. - skegg Nov.
|
In windows, you can twist like this:
#include <stdio.h> #include <stdlib.h> int main() { char s[64] = "echo off & for /l %q in (1,1, ) do echo|set /p=*"; scanf("%s", s+29), (s+29)[strlen(s+29)] = 32; return system(s); }
They also appear beautifully slowly :)
|