Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

I have a varargs function which accepts a float parameter?

1057


Can we change the value of constant variable in c?

1063


What is a macro, and explain how do you use it?

1086


How can I manipulate individual bits?

1048


What are local static variables? How can you use them?

1154


What is meant by realloc()?

1164


What are the functions to open and close file in c language?

1210


What are the advantages of the functions?

1164


What does the format %10.2 mean when included in a printf statement?

1659


What is meant by preprocessor in c?

1017


Is there a way to jump out of a function or functions?

1107


What is the difference between array and pointer?

1035


Compare interpreters and compilers.

1074


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

1080


please send me the code for multiplying sparse matrix using c

2186