What is the output of the following C program? #include<stdio.h> int fac (int x); void main( ) {                         for (int...

80.2K

Verified Solution

Question

Programming

What is the output of the following C program?

#include

int fac (int x);

void main( )

{

                       for (int i=1; i<=2; i++)

                                   printf(\"%d\", fac(i));

}

int fac(int x)

{

                       x = (x>1) ? x + fac(x-1) : 100);

                       return x;

}

Answer & Explanation Solved by verified expert
4.3 Ratings (600 Votes)
The given C program is includeint fac int xvoid main for int i1 i1 x facx1 100 in question    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students