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


Please Help Members By Posting Answers For Below Questions

How do I use strcmp?

825


What does the characters “r” and “w” mean when writing programs that will make use of files?

1167


What are qualifiers and modifiers c?

732


What is c system32 taskhostw exe?

775


How can I delete a file?

813


What is volatile variable in c?

850


Is c still relevant?

839


What is far pointer in c?

999


Here is a good puzzle: how do you write a program which produces its own source code as output?

837


What is FIFO?

1114


What is your stream meaning?

843


What is static memory allocation? Explain

809


c program for searching a student details among 10 student details

1865


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1820


Explain what are preprocessor directives?

817