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
Which is an example of a structural homology?
What is enumerated data type in c?
Can you mix old-style and new-style function syntax?
What are derived data types in c?
Why void main is used in c?
Where define directive used?
What is strcpy() function?
What are the features of c languages?
What are the types of arrays in c?
What are the standard predefined macros?
why we wont use '&' sing in aceesing the string using scanf
What are the advantages of using macro in c language?
What is c standard library?
Can a pointer be volatile in c?
What is extern c used for?