
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 ABCD Repeatedly in C Without Loops or Recursion
In this problem, we have to write a program in c that will print a string ‘ABCD’ repeatedly without using loop, recursion and any control structure.
So, we will have to call or run the same block of code infinite time but without using loop, recursion or control structure which are the most common methods to perform the task. For this, we will run the same program multiple times instead of looping. This will perform our task within the given constraints. The system() method can be employed inside the code that will call the program infinite times.
We will pass the file name to the system() method to run the program repeatedly.
Program to illustrate our solution
Example
//naming the program file main #include<stdio.h> #include<stdlib.h> int main(){ printf("ABCD\t"); system("main"); return 0; }
Output
The program will print ABCD infinate times untill you stop the program execution.
Advertisements