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 / bitan biswas
We can do that by recursive call.....
void fun(int no ){
int t;
printf("%d ",no);
if( no != 100 ){
t=no+1;
fun(t);
}
printf("%d ",no);
}
int main(){
fun(1);
return 0;
}
| Is This Answer Correct ? | 17 Yes | 27 No |
Post New Answer View All Answers
I have a varargs function which accepts a float parameter?
Can we change the value of constant variable in c?
What is a macro, and explain how do you use it?
How can I manipulate individual bits?
What are local static variables? How can you use them?
What is meant by realloc()?
What are the functions to open and close file in c language?
What are the advantages of the functions?
What does the format %10.2 mean when included in a printf statement?
What is meant by preprocessor in c?
Is there a way to jump out of a function or functions?
What is the difference between array and pointer?
Compare interpreters and compilers.
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
please send me the code for multiplying sparse matrix using c