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
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
Where are c variables stored in memory?
How to Throw some light on the splay trees?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
Is flag a keyword in c?
What is pass by reference in c?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
how to find binary of number?
explain what are actual arguments?
#include
How can a program be made to print the line number where an error occurs?
What are multibyte characters?
What is the size of array float a(10)?
What oops means?
What is a program flowchart?