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
4 Antwoorden
+ 1
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
0
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
0
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
0
recursion example: #include <stdio.h> void print_i(int i){ if(i>100) return; printf("%d\n", i++); print_i(i); } int main() { print_i(1); }
26th Sep 2025, 6:31 AM
Bob_Li
Bob_Li - avatar