- Print 1 to 100 without using loop in c
- We print 1 to n numbers without using any loop.
- By using recursive function in C Programming we can print 1 to 100 or 1 to n numbers.
- Now We will write a C program to print one to 100 without using any loops.
- Print 1 to 100 without loop and recursion
Program #1: Write a C program to print 1 to 100 without loop and using recursive function.
- #include <stdio.h>
- #include <stdlib.h>
- int print(int num);
- int main(int argc, char *argv[])
- {
- int number = 1;
- print(number);
- return 0;
- }
- int print(int number){
- if(number<=100){
- printf("%d ",number);
- print(number+1);
- }
- }
Output:
No comments