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 / raveendra

#include<iostream.h>
using namespace std;

int i;
class A
{
public:
static void fun()
{
A a[100];
}
A(){cout<<++i<<"\t";}
~A(){cout<<i--<<"\t";}
};

int main()
{
A::fun();
getchar();
return 0;

}

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are multidimensional arrays?

660


How can I discover how many arguments a function was actually called with?

640


What is infinite loop?

632


What is the basic structure of c?

565


Explain what is the difference between a free-standing and a hosted environment?

641






how do you programme Carrier Sense Multiple Access

1526


What is string function c?

573


What does the c in ctime mean?

576


What is C language ?

1535


Explain how can a program be made to print the name of a source file where an error occurs?

695


What is an operator?

659


Is c object oriented?

546


What is the explanation for the dangling pointer in c?

684


what is reason of your company position's in india no. 1.

1781


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

597