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

Which is an example of a structural homology?

1319


What is enumerated data type in c?

1071


Can you mix old-style and new-style function syntax?

1098


What are derived data types in c?

1076


Why void main is used in c?

1044


Where define directive used?

1087


What is strcpy() function?

1133


What are the features of c languages?

1097


What are the types of arrays in c?

1170


What are the standard predefined macros?

1136


why we wont use '&' sing in aceesing the string using scanf

2364


What are the advantages of using macro in c language?

1113


What is c standard library?

1197


Can a pointer be volatile in c?

979


What is extern c used for?

1053