In this tutorial you will learn about the C Program to Print 1 to 100 without using Loop and its application with practical example.
C Program to Print 1 to 100 without using Loop
In this tutorial, we will learn to create a C program that will Print 1 to 100 without using Loop in C programming.
Prerequisites
Before starting with this tutorial, we assume that you are the best aware of the following C programming topics:
- Operators in C Programming.
- Basic Input and Output function in C Programming.
- Basic C programming.
- Conditional Statements in c programming.
Algorithm:-
1 2 3 4 5 6 7 8 9 10 11 |
1. Declare the variables for the program. 2. Defining the range of numbers. 3. Pass that number to a user defined function. 4. generating the series of number. 5. Print the series of the number. 6. End the program. |
Print 1 to 100 without using Loop.
As we all know, the series printing works are done using the loops, but today we will print a series from 1 to 100 without using Loop. In this program, we will first define the variables for the program. Then we will pass that variable to a user-defined function to print the series.
With C programming, we can make many arithmetic series with just a little code.
With the help of this program, we can Print 1 to 100 without using Loop.
Program:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/* C Program to Print 1 to 100 without using Loop */ #include<stdio.h>//including header files int number(int val) //user defined function for the series { //Generating the series from one to hundred without loop if(val<=100) { //Printing the series from one. printf("%d\t",val); //increasing the value of number by 1 number(val+1); } } //main function body int main() { //Declaring the required variable for the program. int val = 1; //val = it will hold the integer value for the program. //Calling the user defined function. number(val); return 0; } |
Output:-
In the above program, we have first initialized the required variable.
- val = it will hold the integer value for the program.
- num = it will hold the integer value of the number.
Sending the data to the user-defined function for the generation of series.
Program code to print the list up to the given number 100.