Answer:
#include<iostream>
using namespace std;
void c(long int n)
{
static int i=0;
if(n==0)
return ;
i++;
c(n/10);//recursive call
//printing after recursive call
cout<<n%10;
i--;
if(i%3==0 && i!=0)
cout<<",";
if(i==0)
cout<<endl;
}
int main()
{
c(1087045);
cout<<endl;
return 0;
}#include<iostream>
using namespace std;
void c(long int n)
{
static int i=0;
if(n==0)
return ;
i++;
c(n/10);//recursive call
//printing after recursive call
cout<<n%10;
i--;
if(i%3==0 && i!=0)
cout<<",";
if(i==0)
cout<<endl;
}
int main()
{
c(1087045);
cout<<endl;
return 0;
}
output:
1,087,045
Process exited normally.
Press any key to continue . . .
//PLS give a thumbs up if you find this helpful, it helps me alot, thanks.
Explanation: