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 / sandy
#include<iostream>
int i;
class A
{
public:
A(){cout<<i++<<endl;}
~A(){cout<<--i<<endl;}
}
int main()
{
A a[100];
return 0;
}
Is This Answer Correct ? | 41 Yes | 10 No |
Post New Answer View All Answers
Is there anything like an ifdef for typedefs?
Can you add pointers together? Why would you?
Where is c used?
How is a macro different from a function?
Explain how can I prevent another program from modifying part of a file that I am modifying?
Explain what are compound statements?
With the help of using classes, write a program to add two numbers.
Is there a way to jump out of a function or functions?
What does the error message "DGROUP exceeds 64K" mean?
What is the modulus operator?
Is c compiled or interpreted?
Difference between MAC vs. IP Addressing
Write a factorial program using C.
What is a string?
What are the types of data files?