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
Can we assign integer value to char in c?
What is the full form of getch?
Can you apply link and association interchangeably?
What is #line?
How reliable are floating-point comparisons?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What is cohesion in c?
Should I learn c before c++?
Explain goto?
how we can make 3d venturing graphics on outer interface
can we have joblib in a proc ?
What is indirection? How many levels of pointers can you have?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What are run-time errors?
What is the use of header?