I want to know that in this pattern we dont need to print fun(n) value in main because we already print value in fun ()
function. I mean to say that without writing cout in main
how can we print complete pattern as output
About the function
Hey @manoj2597
Yes you are right that we are printing it in fun() function and not in main
I am not able to understand this can you elaborate?
Do you mean to say that if n is 5?
Then how can you print
ABCDE
ABCD
ABC
AB
A
without using for loop?
no i am just asking that we are print this pattern in fun function not in main. so without writing cout statement in main how can this complete pattern prints on console.?
Okay I got it, so we are not writing cout in main, but we are calling function fun() in main, right? So when we call this function fun() from main , it goes in fun() function and there we are printing the pattern. Therefore, what is happening is calling function fun() in main, and printing output in fun() function. You might be new to this concept. But this can be done that you call a function from main, and then print answer in that function 
ok and clear my another doubt also. can we write everytime return 0 in main()?
as in some i am not writng it but still my program executes successfully and in some problems it is not so why this happening. please also tell me that when we have to include return 0 in int main or when not
See if your main function is of int type, then you should definitely write return 0, why ? Because 0 is of int type. So whatever datatype function you have you should return that. Instead of writing return 0 , you can also write return 1 . No issue in that. But ideally it’s expected to write return 0
I would suggest you to always write return 0 in your int main function 
ok but i am not including return 0 and still my program is executing successfully how?
That’s because you might be using c++14 or c++17 which by default takes return 0. Earlier version of c++ always needed return 0
ok and tell me another thing why we want to make function for calculating factorial it can easily done by loop in main so why we make the function outside the main
If you are only doing your work in main function, not working with different functions. It becomes difficult to debug the code. Cause then you have to write entrie code again. I am talking about very long codes. Moreover working with functions makes your code work faster.
Cause we won’t know what part of function is misbehaving
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.