0

IS POSSIBLE TO PRINT 1 TO 100 WITHOUT FOR LOOP

IN C LANGUAGE NOT USE FOR WHILE

26th Sep 2025, 1:16 AM
PARTH CHAUHAN
PARTH CHAUHAN - avatar
5 Respuestas
+ 4
and you can just unroll the loop e.g. type out 100 print statements
26th Sep 2025, 1:40 AM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
+ 2
PARTH CHAUHAN Yes, you can via following ways: 1> Using recursion 2> Using while/do while loop 3> Using goto 3rd point example: ``` int n = 1; start: if (n <= 100) { printf("%d\n", n); n++; goto start; } ```
26th Sep 2025, 1:31 AM
Gulshan Mahawar
Gulshan Mahawar - avatar
+ 2
do/while example: #include <stdio.h> int main() { int i = 1; do { printf("%d\n", i++); } while(i<=100); }
26th Sep 2025, 6:19 AM
Bob_Li
Bob_Li - avatar
+ 1
recursion example: #include <stdio.h> void print_i(int i, int i2){ if(i > i2) return; printf("%d\n", i++); print_i(i, i2); } int main() { print_i(1, 100); }
26th Sep 2025, 6:31 AM
Bob_Li
Bob_Li - avatar
0
#include <stdio.h> #define ZERO(x) (x=0) int main() { int n = 1; while(n) n<=100 ? printf("%d\n", n++) : ZERO(n); }
3rd Oct 2025, 11:49 AM
Bob_Li
Bob_Li - avatar