void abc()
{
auto int a;
static int <=3;
a=++s;
printf(“n %d %d”, a,s);
if(a<=6)
abc();
printf(“n %d %d”,a,s);
}
void main()
{
abc();
abc();
}
o/p : 4 4 5 5 6 6 7 7 6 7 5 7 4 7 8 8 8 8
void xyz()
{
int a;
static int s;
a=s++;
printf(“n %d %d”,a,s);
if(a<=3)
xyz();
printf(“n %d %d”,a,s);
}
int g=5;
void main()
{
auto int a;
static int s=5;
a=s--;
++g;
printf(“n %d %d %d”,a,s,g);
if(a>=3)
abc();
xyz();
}
void xzyz()
{
int a;
static int s;
a=++s;
++g;
printf(“|n %d %d %d”,a,s,g);
if(a<=3)
{
xyz();
printf(“n %d %d %d”,a,s,g);
}
5 4 6 1 1 84 3 7 2 2 7 3 2 8 3 3 6 2 1 9 4 4 5 2 1 9 4 4 5 3 1 9 3 4 5 4 1 9 2 4 5 1 1 9 1 4 5 |
void abc()
{
int a;
static int s=5;
a=--s;
--g;
printf(“n %d %d”,a,s,g);
if(a>=3)
{
abc();
printf(“n %d %d %d”,a,s,g);
}
void main()
{
void xyz(void); // declaration
xyz();
}
void xyz()
{
auto int a;
static int s;
a=s++;
++g;
printf(“n %d %d %d”,a,s,g);
if(a<2)
{
abc();
xyz();
}
printf(“n %d %d %d”,a,s,g);
}
int g=5;
0 1 6 - - > xyz1 2 3 5- -> xyz34 4 5- - >abc 2 3 5- -> xyz33 3 4-- ->abc3 1 3 5- - >xyz2 2 2 3- - >abc3 2 2 3- - >abc2 4 2 3- - >abc 1 1 2 4- - >xyz2 1 1 3- - > 2nd call abc 1 1 3- - > 2nd call abc |
void main()
{
int a=2;
++a;
printf(“%d”,a);
if(a<=3);
main()
printf(“%d”,a);
}
o/p : 3 3 3 …………………………. stack overflow
Void main()
{
static int s=1;
++s;
printf(“%d”,s);
}
o/p : 2 3 4 4 4
int power(intb, int e)
{
if(e<0)
return 0;
elseif(e==0)
return 1;
else
return (b*power(b,e-1));
}
void main()
{
int a,b,p;
clrscr();
printf(“n enter value of a:”);
scanf(“%d”,&a);
printf(“n enter value of b:”);
scanf(“%d”, &b);
p=power(a,b);
printf(“n %d ^ %d value is =%d”,a,b,p);
getch();
}
o/p : 25 = 32
in fact(int n)
{
if(n<0);
return 0;
else if (n<=1)
return 1;
else
return(n*fact(n-1));
}
void main()
{
int n,f
clrscr();
printf(“Enter a value :”);
scanf(“%d”, &n);
f=fact(n);
printf(“n %d fact value is : %d”,n,f);
getch();
o/p : Enter a value 5
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.