- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How will you print numbers from 1 to 100 without using loop in C?
There are several methods to print numbers without using loops like by using recursive function, goto statement and creating a function outside main() function.
Here is an example to print numbers in C language,
Example
#include<stdio.h> int number(int val) { if(val<=100) { printf("%d\t",val); number(val+1); } } int main() { int val = 1; number(val); return 0; }
Output
12345678910111213 14151617181920212223242526 27282930313233343536373839 40414243444546474849505152 53545556575859606162636465 66676869707172737475767778 79808182838485868788899091 9293949596979899100
In the above example, a function number is created with an argument val. If val is less or equal to 100, print the value and increment value by one. In the main() function, val is initialized with 1 and called function number.
if(val<=100) { printf("%d\t",val); number(val+1); }
- Related Articles
- Program to print numbers from 1 to 100 without using loop
- Print 1 to 100 in C++, without loop and recursion
- C Program to print numbers from 1 to N without using semicolon
- Print a number 100 times without using loop, recursion and macro expansion in C
- Print a pattern without using any loop in C++
- C program to print number series without using any loop
- How to print a name multiple times without loop statement using C language?
- C program to print four powers of numbers 1 to 9 using nested for loop
- How to print all the Armstrong Numbers from 1 to 1000 using C#?
- Java Program to print Number series without using any loop
- Print Number series without using any loop in Python Program
- Print a character n times without using loop, recursion or goto in C++
- Python Program to Print Numbers in a Range (1,upper) Without Using any Loops
- How to print a diamond using nested loop using C#?
- Print m multiplies of n without using any loop in Python.

Advertisements