Write a C program to print ‘ABCD’ repeatedly without using loop, recursion and any control structure

CServer Side ProgrammingProgramming

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

 Live Demo

//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.
raja
Published on 15-Jul-2020 06:26:45
Advertisements