- 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
Print a number 100 times without using loop, recursion and macro expansion in C
In this section we will see how to print a number 100 times in C. There are some constraints. We cannot use loops, recursions or macro expansions.
To solve this problem we will use the setjump and longjump in C. The setjump() and longjump() is located at setjmp.h library. The syntax of these two functions are like below.
Example
#include <stdio.h> #include <setjmp.h> jmp_buf buf; main() { int x = 1; setjmp(buf); //set the jump position using buf printf("5"); // Prints a number x++; if (x <= 100) longjmp(buf, 1); // Jump to the point located by setjmp }
Output
5555555555555555555555555555555555555555555555555555555555555555555555555555 555555555555555555555555
- Related Articles
- Print 1 to 100 in C++, without loop and recursion
- Print a character n times without using loop, recursion or goto in C++
- Write a C program to print ‘ABCD’ repeatedly without using loop, recursion and any control structure
- How to print a name multiple times without loop statement using C language?
- C program to print number series without using any loop
- How will you print numbers from 1 to 100 without using loop in C?
- Program to print numbers from 1 to 100 without using loop
- Print a pattern without using any loop in C++
- Print Number series without using any loop in Python Program
- Python Program for Print Number series without using any loop
- Java Program to print Number series without using any loop
- Print root to leaf paths without using recursion in C++ Programming.
- Program to print root to leaf paths without using recursion using C++
- Print ancestors of a given binary tree node without recursion in C++
- Print m multiplies of n without using any loop in Python.

Advertisements