Write a C++ program without using any loop (if, for, while
etc) to print numbers from 1 to 100 and 100 to 1;
Answer Posted / ajeet kumar
#include<stdio.h>
#include<conio.h>
int f(int);
void main()
{
static int n=0;
n++>99 ? 0 : f(n) ; //its value are not used.
}
int f(int n)
{
printf(" %d",n);
main();
printf(" %d",n--); //]internally stack is ctr
return(1);
} /* run firstly,after press alt+F5.
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What is operator promotion?
How can I convert a number to a string?
What is a wrapper function in c?
What are the advantages of union?
What are structural members?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
What is difference between static and global variable in c?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
Does c have circular shift operators?
Why we not create function inside function.
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
What is memcpy() function?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What does typedef struct mean?