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
How can I invoke another program or command and trap its output?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
How can you find the exact size of a data type in c?
Explain main function in c?
What does *p++ do?
Explain the meaning of keyword 'extern' in a function declaration.
There seem to be a few missing operators ..
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the purpose of void pointer?
Does sprintf put null character?
What is the use of header files?
Tell me about low level programming languages.
Why do we use header files in c?
Difference between goto, long jmp() and setjmp()?
How can I insert or delete a line (or record) in the middle of a file?