UrbanPro
true

Learn C++ Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Predict the Output of C Questions based on Recursion and Macro

Yashvardhan Soni
19/10/2018 0 0

#include<stdio.h>
void k(unsigned int i,unsigned int j){
static char x[]="0123456789ABCDEF";
if(i>=j) k(i/j,j);
putchar(x[i%j]);}
void main(){
k(20,12);} 

 

___________________________________________

 

#include<stdio.h>
int test(int a,int b){
if(a==b) return 1;
else if(a>b)return 0;
else return(a+test(a+1,b));
}
main(){
int x;
x=test(0,3);
printf("%d",x);} 

 

____________________________________________________________

 

#include<stdio.h>
main(){
int x(int,int);
printf("%d\n", x(1,1));}
int x(int m,int n){
if(m==0)return n+1;
if(m>=1&&n==0)
return x(m-1,1);
else
return x(m-1,x(m,n-1));} 

______________________________________________________________________


#include<stdio.h>
int f(char *p);
main()
{
char *p="hello";
f(p);
}
int f(char *p)
{
if(*p?f(++p):1)
printf("%c", *(--p));
return 1;
}

_________________________________________________________________
#include<stdio.h>
#define MAIN() main()
#define mAIN() Main()
int MaIn() {printf("Main ");}
int mAIN() {printf("main ");}
int MAIN() {printf("MAIN "); mAIN();}

___________________________________________________________

 

#include<stdio.h>
void foo(int n){
int m=1;
if(n){m++;
foo(n+1);}
m++;printf("m=%d, n=%d\n", m, n);
}

main(){
foo(-3);}
---------------------------------------------------------------------------------------------------------#include<stdio.h>
main(){
int For;
for(For=0;For<=6;For++)
for(For=0;For<=3;For++)
for(For=0;For<=5;For++)
printf("%d\n", For);
printf("%d\n", For);}

 

_________________________________________________________________
#include<stdio.h>
#define max(a,b) a>b?a:b
main(){
int m,n;
m=3+max(2,3);
n=2*max(3,2);
printf("%d %d", m, n);}

________________________________________________________________
#include<stdio.h>
int zap(int n){
if(n<=1)
return 1;
else
return(zap(n-3)+zap(n-1));}
main(){
printf("%d\n",zap(6));} 

_______________________________________________________________
#include<stdio.h>
#define ceil(x, y) (x+y-1)/y

main(){
int a,b,c;
b=1;c=1;
a=ceil(b&c, sizeof(int));
printf("%d \n", a);}
_________ _______________________________________________
#include<stdio.h>
void revs(char *c) {
if(*c!='\0'){
c++;revs(c++);
printf("%c",*c);}}
main(){
char c[10]="hello";
int n;
n=strlen(c);
revs(c);}
________________________________________________________________

0 Dislike
Follow 3

Please Enter a comment

Submit

Other Lessons for You

C, C++, JAVA Tutor
* Program to swap two numbers using a temporary variable with each statement explained with comments * #include // headerfile for cout statement using namespace std; //...

Tress And Its Traversal
Depth First Traversals:(a) Inorder (Left, Root, Right) : 4 2 5 1 3(b) Preorder (Root, Left, Right) : 1 2 4 5 3(c) Postorder (Left, Right, Root) : 4 5 2 3 1 Trees are one of the data structures like...

Is It Fine To Write “void main()” Or “main()” In C/C++?
The definition: void main() { /* ... */ } Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1 or the ISO C standard 5.1.2.2.1. A conforming...

Advantages of C++ Language
Advantages of C++ - C++ is a profoundly convenient dialect and is frequently the dialect of decision for multi-gadget, multi-stage application advancement. - C++ is a protest situated programming dialect...

Interview Questions
(1) What is the output of below program: For(char i = 0; i<256; i++)Printf(“%d\n”,i); Modify above program so that it can prints number from 0 to 255. (2) Consider on following declaration: (i)...
X

Looking for C++ Language Classes?

The best tutors for C++ Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C++ Language with the Best Tutors

The best Tutors for C++ Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more