Recursive function in c programming4/6/2024 In this step we declare or function (sum()). If yes then compilers advances to net step. Like always the compiler checks if all necesarry header files are present or not. If any error occurs the program will return 0. It passes value n to function definition.ġ1.return statement is use to return a value. It indicates that the program returns a value.Ħ.main() is main function that indicates the compiler that the user written programs starts from here.Ĩ.print/cout is the keyword use to print a message.ĩ.scanf/cin is the keyword use to store values in variables.ġ0. It takes an integer value as parameter.ĥ.int is data type. It is used to include header files.Ģ.stdio/iostream is header file which has certain commands that c/c++ supports. Program in C++: //Sum of n numbers using recursionġ. Printf("\n Sum of n numbers is : %d",sum(n)) //Function callingĢ. Int sum(int) //Function declaration or prototype Program in C: //Sum of n numbers using recursion Write a program to calculate sum of n numbers using recursion. Now we will see an example to under the concept of recursion.Įg.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |