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
How can I prevent another program from modifying part of a file that I am modifying?
Explain setjmp()?
Define the scope of static variables.
Explain what is a pragma?
What does c value mean?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
Can a file other than a .h file be included with #include?
why programs in c are running with out #include
What is data structure in c and its types?
What is the full form of getch?
what are non standard function in c
Apart from dennis ritchie who the other person who contributed in design of c language.
Write a code to determine the total number of stops an elevator would take to serve N number of people.
How can I copy just a portion of a string?
What is a void * in c?