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 / shubham gupta

#include<stdio.h>
void fun(int n)
{
static int i=1,j;
printf("%d\n",i);
(100-i)?(i++?fun(n):0):exit(0);

}
int main()
{
int n;
n=100;
fun(n);
}

Is This Answer Correct ?    1 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of pointer?

1027


What is the use of header files?

1072


Write the syntax and purpose of a switch statement in C.

1064


How are structure passing and returning implemented?

1007


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1015


What is signed and unsigned?

1025


Explain what is the benefit of using #define to declare a constant?

1123


Give me the code of in-order recursive and non-recursive.

1335


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1076


When is the “void” keyword used in a function?

1441


What are dangling pointers in c?

1148


What should malloc(0) do?

1067


Explain how do you determine a file’s attributes?

1018


Can a variable be both const and volatile?

1093


For what purpose null pointer used?

1028