You should've been a doctor, cause I can't read ANY of that!
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { for (int i = 0, i <= 3; i++) { switch (i) { case 0: printf("1"); break; case 1: printf("12"); break; case 2: printf("123"); break; case 3: printf("1234"); break; } } return EXIT_SUCCESS; }
It can't be more elegant than this, #include <stdio.h> int main() { char s[] = {'1','2','3','4'}; for(int i=0;i<4;i++){ printf("%.*s\n",i+1,s); } }
#include <unistd.h> int main() { char* cons_nums = "12345"; for(int i = 1; i < 6; i++) { write(1, cons_nums, i); write(1, "\n", 1); } }
yes
int i= 1, j= 11, m = 100; for(int k = 0; k < input ; k++){ printf("%d\n", i); i = i + j; j = j + m; m = m * 10; } How's this?
Обсуждают сегодня