Structure of the Problem Requirements
This Program will print 1 to 100 counting without loop in C++ . For this program we used recursive function. A recursive function is that which call itself again and again. The function calling is in the body of the function and when we want to terminate the function we apply some condition to it which called base case.Source Code
#include<iostream>
using namespace std;
int counting (int start);
int main ()
{
cout<<"\t \t \t LEP Tutorials \n \n ";
int start = 1;
counting(start);
}
int counting (int start)
{
if (start<=100)
{
cout<<start<<" ";
counting(start+1);
}
}
Output of the Program
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
0 comments:
Post a Comment