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
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
Explain how can I pad a string to a known length?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
why programs in c are running with out #include
Can static variables be declared in a header file?
What is difference between Structure and Unions?
The file stdio.h, what does it contain?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What is include directive in c?
What are the types of macro formats?
how to construct a simulator keeping the logical boolean gates in c
How do I get an accurate error status return from system on ms-dos?
Explain modulus operator. What are the restrictions of a modulus operator?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
Explain 'bus error'?