- 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 1 to 100 in C++, without loop and recursion
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 using goto statement in C++ language,
Example
#include <bits/stdc++.h> using namespace std; int main() { int count=1; int x; cout << "Enter the max value of x : "; cin >> x; PRINT: cout << " " << count; count++; if(count<=x) goto PRINT; return 0; }
Output
Enter the max value of x : 1
In the above program, we used GOTO statement to print the numbers from 1 to 100 without using loops and recursion.
PRINT: cout << " " << count; count++; if(count<=x) goto PRINT;
- Related Articles
- Print a number 100 times without using loop, recursion and macro expansion in C
- Program to print numbers from 1 to 100 without using loop
- How will you print numbers from 1 to 100 without using loop in C?
- 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
- Print root to leaf paths without using recursion in C++ Programming.
- Print a pattern without using any loop in C++
- C program to print number series without using any loop
- Program to print root to leaf paths without using recursion using C++
- Printing 1 to 1000 without loop or conditionals in C/C++
- Print ancestors of a given binary tree node without recursion in C++
- How to print a name multiple times without loop statement using C language?
- Java Program to print Number series without using any loop
- Postorder traversal of Binary Tree without recursion and without stack in C++
- Print Number series without using any loop in Python Program

Advertisements