answersLogoWhite

0


Best Answer

#include<stdio.h>

int n fact (int n);

int r fact (int n);

main()

{

int n,x,y;

printf("enter the number");

scanf("%d",&n);

x=nfact(int n);

printf("n fact result=%d",x);

getch();

}

int n fact(int n)

{

int i,f=1;

if(n==0::n==1)

return(1);

else

for(i=1;i<=n;i++)

f=f*i;

return(f);

}

int r fact(int n);

{

if(n==0)

return(1);

else

return(n*r fact(n-1));

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program that use both recursive and non-recursive functions?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a c program to find GCD of two given integers by using both recursive n non recursive functions?

i love u darling


Why recursive solution is better for tree traversal?

Because a tree is a recursive data-structure. It's easier to write (and easier to understand) a recursive program for handling it.


Jntu 2-2 oops through java answers?

write a java program to find factorial using recursive and non recursive


Write a program to illustrate the usage of pointers with arrarys and functions?

* * * * * * * * * * write the c++ program and show me brifily?


How do you write a program in C using the fprint and fscan functions?

By using those two functions in your code.


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


What is the importance of functions in a c plus plus program?

Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.


Write C program using functions to simulate a Calculator with the basic functions - square root and reciprocal?

trytytytytytytytytrf 6 bcvvtgujhy6


How do you write a C program to find the GCD of two given integers using non recursive functions?

Use the following function: int gcd (int a, int b) { while (b != 0) { a %= b; a ^= b ^= a ^= b; } return a; } Note that a ^= b ^= a ^= b is an efficient method of swapping two values.


How many essential functions are required to write a c program and write those?

One.int main (void) { return 0; }


Why we write java program using classes?

Classes are well organised functions in java which help discriminate between two different functions.


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.