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
Why c is called a middle level language?
if p is a string contained in a string?
Describe the order of precedence with regards to operators in C.
What is difference between stdio h and conio h?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Is it possible to execute code even after the program exits the main() function?
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
Write a code of a general series where the next element is the sum of last k terms.
What's the difference between constant char *p and char * constant p?
What is memcpy() function?
Is c still used?
List a few unconditional control statement in c.
What is union and structure?
What is variable in c example?