# Q.1

```
Take as input a natural number, say n. Output all subsets of {1,2,...,n}.
You cannot use functions or recursion.
```

# Q.2

```
Write a program to read a sequence of non-zero integers till the number zero is entered and at the end display the following:
a) the number of even and odd numbers,
b) sum of all the numbers entered,
c) the length and starting index (or position) of a largest subsequence of consecutive non-decreasing integers entered. Assume that the index of the numbers start from 1.
For example, if the user input is 1 -2 3 17 9 5 -10 -12 0, then the output will be:
No. of even numbers: 3
No. of odd numbers: 5
Sum of the numbers: 11
Length of largest non-decreasing subsequence: 3
Starting index: 2
Note: Do not use arrays.
```

## Comments

Sort by:

TopNewesti got it @Agnishom Chattopadhyay – Rishabh Deep Singh · 1 year, 1 month ago

Log in to reply

– Agnishom Chattopadhyay · 1 year, 1 month ago

Nice!Log in to reply

– Rishabh Deep Singh · 1 year, 1 month ago

ThanksLog in to reply

Log in to reply

Thanks @Agnishom Chattopadhyay Can u post a solution to Question no 1. – Rishabh Deep Singh · 1 year, 1 month ago

Log in to reply

– Agnishom Chattopadhyay · 1 year, 1 month ago

Try answering the hintLog in to reply

– Rishabh Deep Singh · 1 year, 1 month ago

i need to submit my assignment now please post the answer Bro.Log in to reply

I have increased the scope of your problems from C to all other languages by editing "C" out of the discussion.

Hint about 2: How do functions work? What is the underlying data structure that keeps track of where the execution should return to? – Agnishom Chattopadhyay · 1 year, 1 month ago

Log in to reply

Answer 2.

Log in to reply