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

Differentiate between new and malloc(), delete and free() ?

677


Explain how to reverse singly link list.

609


What are type modifiers in c?

625


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1909


What are pointers? What are stacks and queues?

585






How many bytes is a struct in c?

728


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1862


What is extern variable in c with example?

541


What is fflush() function?

648


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2337


What is the role of && operator in a program code?

572


Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer

3846


What is the value of h?

596


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

663


Why shouldn’t I start variable names with underscores?

627