

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- Print 1 to 100 in C++, without loop and recursion
- Print a character n times without using loop, recursion or goto in C++
- Program to print numbers from 1 to 100 without using loop
- How to print a name multiple times without loop statement using C language?
- How will you print numbers from 1 to 100 without using loop in C?
- C program to print number series without using any loop
- Print a pattern without using any loop in C++
- Write a C program to print ‘ABCD’ repeatedly without using loop, recursion and any control structure
- 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++
- Write a C macro PRINT(x) which prints x
Advertisements