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
Hai what is the different types of versions and their differences
Explain what are linked list?
What is the purpose of void pointer?
What is the acronym for ansi?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
Is Exception handling possible in c language?
Why can’t we compare structures?
What is line in c preprocessor?
Why is c platform dependent?
Why can arithmetic operations not be performed on void pointers?
Explain the use of bit fieild.
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.
What is a const pointer in c?
What do you mean by scope of a variable in c?
What is s or c?