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
How can a number be converted to a string?
Multiply an Integer Number by 2 Without Using Multiplication Operator
Does c have enums?
What is calloc() function?
What are predefined functions in c?
Explain what are linked list?
What should malloc() do?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
Describe the order of precedence with regards to operators in C.
How do I convert a string to all upper or lower case?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
Write program to remove duplicate in an array?
What is the deal on sprintf_s return value?
Explain the use of bit fieild.
Explain what are multidimensional arrays?