
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
How to print a name multiple times without loop statement using C language?
Problem
Try to print a name 10 times without using any loop or goto statement in C programming language.
Solution
Generally, looping statements are used to repeat the block of code until condition is false.
Example1
In this program, we are trying to print a name 10 times without using loop or goto statements.
#include <stdio.h> void printname(char* name,int count){ printf("%03d : %s
",count+1,name); count+=1; if(count<10) printname(name,count); } int main(){ char name[50]; printf("
Enter you name :"); scanf("%s",name); printname(name,0); return 0; }
Output
Enter you name :tutorialspoint 001 : tutorialspoint 002 : tutorialspoint 003 : tutorialspoint 004 : tutorialspoint 005 : tutorialspoint 006 : tutorialspoint 007 : tutorialspoint 008 : tutorialspoint 009 : tutorialspoint 010 : tutorialspoint
Example 2
Below is the program to print your name 10 times using any loop or goto statement −
#include <stdio.h> int main(){ char name[50],i; printf("
Enter you name :"); scanf("%s",name); for(i=0;i<10;i++){ printf("%s
",name); } return 0; }
Output
Enter you name :TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint TutorialsPoint
- Related Articles
- Print a character n times without using loop, recursion or goto in C++
- Print a number 100 times without using loop, recursion and macro expansion in C
- Print a pattern without using any loop in C++
- C program to print number series without using any loop
- How will you print numbers from 1 to 100 without using loop in C?
- How to print a diamond using nested loop using C#?
- C++ Program to Print “Even” or “Odd” without using conditional statement
- C Program to print “Even” or “Odd” without using Conditional statement
- C program to print name inside heart pattern using for loop.
- Java Program to print Number series without using any loop
- Program to print numbers from 1 to 100 without using loop
- Print 1 to 100 in C++, without loop and recursion
- 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

Advertisements