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
What is character set?
cavium networks written test pattern ..
What is hashing in c?
Why can't I perform arithmetic on a void* pointer?
What is the difference between #include and #include 'file' ?
What is the use of #define preprocessor in c?
What does %p mean c?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What is variables in c?
Why do we use static in c?
What oops means?
Can static variables be declared in a header file?
which is an algorithm for sorting in a growing Lexicographic order
Which is better oop or procedural?
How to create struct variables?