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 is the value of a[3] if integer a[] = {5,4,3,2,1}?
Why doesn't C support function overloading?
What is the difference between malloc() and calloc() function in c language?
What do you mean by keywords in c?
What is action and transformation in spark?
Can a variable be both static and volatile in c?
Does c have circular shift operators?
What are the various types of control structures in programming?
Explain the advantages of using macro in c language?
Create a simple code fragment that will swap the values of two variables num1 and num2.
How do I use void main?
What is volatile c?
What is the use of function in c?
What is a sequential access file?
can we change the default calling convention in c if yes than how.........?