Find the best tutors and institutes for C++ Language

Find Best C++ Language Classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

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 1

Please Enter a comment

Submit

Other Lessons for You

Magic in C=> OFFSET OF MACRO in C [offsetof(TYPE, MEMBER)]
Here I am going to discuss an exciting macro in C. It will give you offset of a member within a structure. NULL or 0 address is typecasted to TYPE first. It won't result in segmentation fault as we are...

Jyotishkar Dey | 20 May

0 0
0

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...

Definite book guides for C++
This post attempts to collect the few pearls among the dozens of bad C++ books. Unlike many other programming languages, which are often picked up on the go from tutorials found on the internet, only...

Siddharth | 22/09/2018

0 0
0

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; //...

Sumit Singh | 24/07/2018

0 0
0

How are C And C++ Different Form Each Other
1.C and C++ both have data types operator and conditional looping control statements. But the difference is that C++ has to object-oriented concepts which C programs do not have. Hence C program is like...

Suprio Dutta | 02/07/2018

0 0
0

Looking for C++ Language Classes?

Find best C++ Language Classes in your locality on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
Sponsored

Find Best C++ Language Classes?

Find Now »

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 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 6.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