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
Is c easier than java?
What is gets() function?
Under what circumstances does a name clash occur?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
What is sorting in c plus plus?
What is a MAC Address?
What is the general form of function in c?
provide an example of the Group by clause, when would you use this clause
What is the use of in c?
What are the types of functions in c?
Explain how do you list files in a directory?
What are the rules for the identifier?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
What is identifiers in c with examples?
What is the difference between int main and void main in c?