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

define string ?

853


What are qualifiers?

797


What are compound statements?

830


what type of questions arrive in interview over c programming?

1764


What does *p++ do?

788


Explain how do you determine whether to use a stream function or a low-level function?

821


Tell me what are bitwise shift operators?

868


Can I initialize unions?

800


Explain how can I convert a number to a string?

853


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1935


Is there any possibility to create customized header file with c programming language?

816


Explain how do you sort filenames in a directory?

798


Define C in your own Language.

817


What does %2f mean in c?

952


How can you increase the size of a statically allocated array?

833