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


Please Help Members By Posting Answers For Below Questions

What are the 4 types of functions?

566


What is a spanning Tree?

947


Write a program to print ASCII code for a given digit.

680


What is array of pointers to string?

562


What is scanf () in c?

656






Explain 'bus error'?

555


Can a variable be both constant and volatile?

556


What is the use of structure padding in c?

561


What does 3 periods mean in texting?

595


Why array is used in c?

549


List some of the dynamic data structures in C?

785


how can f be used for both float and double arguments in printf? Are not they different types?

605


What is mean by data types in c?

547


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

654


What are header files and explain what are its uses in c programming?

605