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 are the 4 types of functions?
What is a spanning Tree?
Write a program to print ASCII code for a given digit.
What is array of pointers to string?
What is scanf () in c?
Explain 'bus error'?
Can a variable be both constant and volatile?
What is the use of structure padding in c?
What does 3 periods mean in texting?
Why array is used in c?
List some of the dynamic data structures in C?
how can f be used for both float and double arguments in printf? Are not they different types?
What is mean by data types in c?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
What are header files and explain what are its uses in c programming?