Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Recursive Functions
Recursion is a process by which a function includes itself with a condition for its safe exit. It is best suitable for a recursive problem. A typical example is the factorial problem, the programs without and with recursive functions are shown below.
void main()
{
long factorial ( int num); // Forward declaration of
//a function
int num;
printf("\n Enter a number:");
scanf("5d",&num);
printf(" Factorial of 5d is %ld",num,factorial(num));
}
long factorial(int num) // Non recursive
long f=1;
while ( n)
f = f * n;
n--;
return(f);
long factorial(int num) // Recursive
if(n == 1)
return (1);
else
return( n* factorial(n-1));
We can combine more than one variable on the same line i.e. float number1,number2,number3; etc Sometimes we want to mix the variable types used on the same line, this could
WAP TO SWAP THE THREE DIGIT NUMBER void main () { int b,r,n,r1,r2; clrscr (); printf ("Enter the Value: "); scanf ("%d",&n); r=n%10; n=n/10; r1=n%10;
Write a C program to compute the factorial of 5 i.e. 1x2x3x4x5 etc Write a C program to calculate the output Y for a given value of X for the following formula. Y=X 2
Default argument: When the argument is missing then the function will read the default value of the missing argument. To make use of default argument functionality the argu
At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes
write a class player that contain attributes for the player,s name,average and team
Question: a) Give two uses of NFS. b) Give one advantage of using NFS. c) Explain the following lines as they would be interpreted in the /etc/exports file i. /usr/local
Q: When should you employ multiple inheritance? A:There are three acceptable answers:- "Rarely," "Never," and "while the problem domain cannot be modeled accurately any
#question:-program to counts tha no of occurances of the string in the nth padovan string
Program to sort a range of numbers with Insertion: /* define variable */ const int max=29000; int list[max]; FILE *fp; clock_t start,end; char any1[8];
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd